Re: SP's and SQLERRD ???
Posted in 1995
At 06:22 PM 8/10/95 GMT, June Tong wrote: >Jon C. Vemo (jvemo@cyberspace.com) wrote: >: Within a SP, I want to perform a select. After the select, I want to >: determine whether any rows were found. According to TFM, using dbinfo to get >: 'sqlca.sqlerrd2' will return the number of rows processed. Only problem, it >: doesn't return anything near accurate results. > >Just as in 4GL & ESQL/C, "number of rows processed" really applies only to >UPDATEs and DELETEs, not to SELECTs. For SELECT's it's pretty much the same >as the sqexplain.out "Estimated Rows Returned". I'm afraid that the two >options for figuring out number of rows selected are the same two there've >always been: FETCH all the rows and count them, or SELECT COUNT(*) June - I don't mean to sound rude, but RTFM. Guide to SQL:Syntax, version 7.1, pg 1-568, bottom of page, section entitled "Using the 'sqlca.sqlerrd2' Option", first two paragraphs. I quote; "The 'sqlca.sqlerrd2" option returns a single integer that provides the number of rows processed by SELECT, INSERT, DELETE, UPDATE, and EXECUTE PROCEDURE statements." I'm actually not as interested in the number of rows returned, but more interested in trying to determine if ANY rows were returned from the query. Since I can't use the STATUS variable in a SP, how can I determine whether the query returned anything?? Jon ==================================================== Jon Vemo Internet: jvemo@cyberspace.com Bothell, WA USA Watch out for road-kill on the information superhighway....SPLAT!! ====================================================