Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Question for Shriyan

Status
Not open for further replies.

Gerilee

Programmer
Mar 23, 2001
47
US
Hi Shriyan,

In the solution that you gave me, I am trying to figure out the line -- "select dbinfo('sqlca.sqlerrd2') into cnt from systables where tabid = 1".

I have never used "select dbinfo". When I do error checking, I usually just check the SQLCODE for anything other than 0 with an IF statement and then write the SQLERRD2 to a variable and check that for the reason for the error. I looked up the dbinfo function but this didn't help much.

Also, why tabid = 1? Will it always be 1 or how do you know?

Thanks.
 
Hi Gerilee,

You are right, when you said while looking for errors, you check SQLCODE. This is available is Frontend applications like Informix 4GL. But Stored Procedure does not provide facility of sqlcode for error checking. Instead one has to rely on dbinfo function. dbinfo("sqlca.sqlerrd2") returns the number of rows effected by a DML statement.

Since I invoked this function through a dummy SQL statement, I should guarantee that only one rows is returned. To accomplish this we should target a table with single row, and make sure that the row always exists. System Catalogue table systables is ideal for this kind of manipulations. You will ALWAYS find a table under the id 1 in systables.

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top