Re: SELECT INTO when there is no data.

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Mon, 22 Mar 2004 06:48:17 -0500
Message-ID: <Ir6dndGnRf4AT8PdRVn-jA_at_comcast.com>


"moshe" <Moshe_t_at_yahoo.com> wrote in message news:616be6f6.0403220131.12cba5a0_at_posting.google.com...
| Still, I can't use it in FOR LOOP (cursor).
| I have FOR LOOP, and I would like that the loop will continue even
| there's NO_DATA_FOUND or TOO_MANY_ROWS or other exceptions.
| I don't like to stop the procedure. I want to handle with that
| exceptions and keep moving to the next record.
| I read in the doc's many pages. I understood that the EXCEPTION comes
| after the END. Meaning that the EXCEPTION will stop my procedure/loop.
| and I can't go back in order to continue the procedure with the next
| record.
|
| Am I right ? What would you do in that case ?
|
| With lot of thanks,
| Moshe.
|
|

exception comes prior to the end

handled exceptions allow continuation of processing after the block that contains the exception

exceptions are raised by SELECT INTO statements but not by cursor processing or cursor for loops

for a cursor, use cursor_name%NOTFOUND and other cursor attributes (see PL/SQL manual under cursor attributes)

cursor for loops exit when no data is found (and have no iterations if no rows are found)
so, for a cursor for loop, if you need to know how many rows were processed, you need to initialize a counter (or some type of variable) prior to the loop and set it within the loop

;-{ mcs Received on Mon Mar 22 2004 - 12:48:17 CET

Original text of this message