On 01/30/2016 01:22 AM, Frank Millman wrote: > There are times when I want to execute a SELECT statement, and test for > three possibilities - > - if no rows are returned, the object does not exist > - if one row is returned, the object does exist > - if more that one row is returned, raise an exception
Is there a reason you cannot get SQL to answer this question for you? Something like: SELECT count(some_field) WHERE condition That will always return one row, with one field that will either be 0, 1, or more than 1. -- https://mail.python.org/mailman/listinfo/python-list