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!

Question for Shriyan

Status
Not open for further replies.

Gerilee

Programmer
Mar 23, 2001
47
US
Hello,

Thanks so much for your guidance about INFORMIX triggers. It was a great help but I have a few questions. In the CREATE PROCEDURE section of the code in your solution, I'm confused about the WHILE section. Why while 1=1? Also, I am assuming that the if statements that check the cnt are to stop the procedure when there's an error. Is that right? In the EXECUTE PROCEDURE statement in the trigger, I am assuming that f1, f2, f3 are the columns from tab1 and that tab2 is a duplicate of tab1 with mrem added to tab2. Thanks again.

 
Gerilee:

Happy to note that my reply/solution to your question helped you greatly.

While 1=1 is equivalent to while (true), normally this style coding is followed by C programmers. Your assumption on variable cnt is right. After inserting the row I am checking the sqlcode for the success/failure status. One can not predict the one's DML SQL statement line INSERT will be through without any muti-user related problem in first go. Appropreate error checking and diagnosing techniques in crucial code segment is very important. Yes, tab2 is copy tab1 and columns are f1,f2 ...

Regards,
Shriyan
 
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 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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top