can someone tell me why...... after going thru the loop and if statement..and meeting the correct condition (lets say.. it found C).... instead of hitting the "exit when cursor not found", it goes up and starts the loop again... and then it raises one of the exceptions and quits. any ideas? must be my syntax
------------------------------------------------------------------
OPEN Cursor;
Well, for clarity, it would help to use a bit more actual code. When you say "open cursor," and then do the "fetch x into v-xxx," in real life, are you coding "open x" so the fetch statement is in the correct syntax (fetch x the cursor name into v_xxx the record name)?
Originally posted by kyleknicks can someone tell me why...... after going thru the loop and if statement..and meeting the correct condition (lets say.. it found C).... instead of hitting the "exit when cursor not found", it goes up and starts the loop again... and then it raises one of the exceptions and quits. any ideas? must be my syntax
First, if C evaluates to be true (IF C then raise...), you are done with the loop. You can go thru the loop as little as one time. Raising an exception is a way to exit a loop. So your "let's say it found C" means you would not hit the %NOTFOUND check.
If the process started the loop again, you must have hit the ELSE statement and did nothing (null) except cycle thru the loop. There are two ways to exit the loop in your case: an IF-THEN evaluates to true (so you raise an exception), or your cursor is either NOTFOUND because there are no records, or you have processed the last record.
Bookmarks