Re: ESQL C problem with sqlerrd[2]
Posted in 1992
ray@unlv.edu (Ray Tripamer) writes: >The sqlca.sqlerrd[2] value DOES NOT hold the number of rows found by opening >a cursor for a select statement (dynamic or otherwise). The sqlerrd[2] value >is filled in only by the update and delete statements (maybe insert too), but >not by a select. >The only way to get the number of rows from a select statment is to >execute some type of "select count(*) into $cnt ..." statement with the same >from and where clause as the original select statement. >-- A little clarification at this point; sqlca.sqlerrd[2] holds the values of the last SERIAL value inserted. sqlca.sqlerrd[3] will hold the TRUE number of updates and deletes but only the first of an insert or select. This is because both insert and select statements need cursors if they are to manipulate more than one row at a time, while update or deletes will affect every row in the table unless some criteria is specified. Hope this clears up any misunderstanding.