Error Checking in ESQL/C

Aggregate functions always return exactly one row. If no rows are selected, the function returns a NULL. You can use the COUNT (*) function to determine whether any rows were selected, and you can use an indicator variable to determine whether any selected rows were empty. Fetching a row with a cursor that is associated with an aggregate function always returns one row; hence, 100 for end of data is never returned into the sqlcode variable for a first FETCH attempt.

You can also use the GET DIAGNOSTICS statement for error checking.