If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Scope of whenever in embedded SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-06, 01:54
noblesilence noblesilence is offline
Registered User
 
Join Date: Apr 2006
Posts: 2
Question Scope of whenever in embedded SQL

Suppose we have the following C fragment of code:
Code:
exec sql whenever sqlerror stop;
exec sql connect ...;
.
.
.
goto l7;
.
.
.
exec sql whenever sqlerror goto l2;
exec sql select ...;
.
.
.
l7;
.
.
l2;
.
.
.
Then, after the goto l7, the flow of our program will jump to l7. After l7 and onwards, which whenever statement does it apply?
Reply With Quote
  #2 (permalink)  
Old 05-15-06, 11:39
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Homework, homework, homework...
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #3 (permalink)  
Old 05-16-06, 01:10
noblesilence noblesilence is offline
Registered User
 
Join Date: Apr 2006
Posts: 2
It's not homework. I am just doing self-study.

I read it from the book "Relational Database Systems" by Dan A. Simovici, Richard L. Tenney, published by Academic press, in 1995.

In chapter 4, Embedded SQL, on page 153, after the above code (I changed lab to l), in the second last paragaph, it says:

Quote:
"The scope of the first whenever extends to the statement that precedes the second whenever. If an error occurs in the select statement, the execution wll jump to the statement labeled lab2. The jump goto lab7 that will make the control flow bypass the second select has no impact whatsoever on the effect of the second whenever on the select, because the scope of any whenever has a strictly lexical, static character."
From the above explanation, my understanding is that the second whenever will apply after l7 and onwards.

I want to make sure that my understanding is correct. That's why I asked this. I tried to search for it in the esql documentation of Ingres but couldn't find.

Last edited by noblesilence; 05-16-06 at 01:14.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On