RE: a PL/SQL question - how to catch errors without going into ex
ps , i meant i := 1; while i 10 loop select the_name from the_table into myvar where the_id = i ; end loop; DBAndre -Original Message- From: Andrey Bronfin Sent: Thu, April 04, 2002 9:50 PM To: [EMAIL PROTECTED] (E-mail); [EMAIL PROTECTED] (E-mail); oralist@lists (E-mail) Subject: a PL/SQL question - how to catch errors without going into exceptions block Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: a PL/SQL question - how to catch errors without going into ex
Enclose your statements in another BEGIN/EXCEPTION/END block. Strategic placement of these blocks will achieve what you are looking for. Lisa Koivu Oracle Database TANK Fairfield Resorts, Inc. 954-935-4117 -Original Message- From: Andrey Bronfin [SMTP:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 1:44 PM To: Multiple recipients of list ORACLE-L Subject: a PL/SQL question - how to catch errors without going into except Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Koivu, Lisa INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: a PL/SQL question - how to catch errors without going into ex
Will something like this work for you (crude but ...) BEGIN LOOP BEGIN SELECT ... EXCEPTION WHEN NO_DATA_FOUND THEN EXIT; END; END LOOP EXCEPTION END; -- Chris J. Guidry P.Eng. EE ATCO Electric, Metering Services Phone: (780) 420-4142 Fax: (780) 420-3854 Email: [EMAIL PROTECTED] -Original Message- From: Andrey Bronfin [SMTP:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 11:49 AM To: Multiple recipients of list ORACLE-L Subject: RE: a PL/SQL question - how to catch errors without going into ex ps , i meant i := 1; while i 10 loop select the_name from the_table into myvar where the_id = i ; end loop; DBAndre -Original Message- From: Andrey Bronfin Sent: Thu, April 04, 2002 9:50 PM To: [EMAIL PROTECTED] (E-mail); [EMAIL PROTECTED] (E-mail); oralist@lists (E-mail) Subject:a PL/SQL question - how to catch errors without going into exceptions block Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Guidry, Chris INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: a PL/SQL question - how to catch errors without going into ex
You can always start a new block with its own exception handler Begin .. .. Begin .. Exception when ... .. End; End; -Original Message- Sent: Thursday, April 04, 2002 1:49 PM To: Multiple recipients of list ORACLE-L ps , i meant i := 1; while i 10 loop select the_name from the_table into myvar where the_id = i ; end loop; DBAndre -Original Message- From: Andrey Bronfin Sent: Thu, April 04, 2002 9:50 PM To: [EMAIL PROTECTED] (E-mail); [EMAIL PROTECTED] (E-mail); oralist@lists (E-mail) Subject: a PL/SQL question - how to catch errors without going into exceptions block Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Khedr, Waleed INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: a PL/SQL question - how to catch errors without going into ex
Andrey, Do some reading on exception handling scope in FM. This is what you want: i := 1; while i 10 loop begin select the_name from the_table into myvar where the_id = i ; EXCEPTION WHEN NO_DATA_FOUND THEN NULL: end; end loop; Igor Neyman, OCP DBA [EMAIL PROTECTED] - Original Message - To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] Sent: Thursday, April 04, 2002 1:48 PM ps , i meant i := 1; while i 10 loop select the_name from the_table into myvar where the_id = i ; end loop; DBAndre -Original Message- From: Andrey Bronfin Sent: Thu, April 04, 2002 9:50 PM To: [EMAIL PROTECTED] (E-mail); [EMAIL PROTECTED] (E-mail); oralist@lists (E-mail) Subject: a PL/SQL question - how to catch errors without going into exceptions block Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: a PL/SQL question - how to catch errors without going into ex
Have you considered just adding another exception handler: i := 1; while i 10 loop begin select the_name from the_table into myvar where the_id = i ; exception when others then null; - or whatever you want to do; end; end loop; The net effect is the same. HTH - Brian -Original Message- Bronfin Sent: Thursday, April 04, 2002 12:49 PM To: Multiple recipients of list ORACLE-L ex ps , i meant i := 1; while i 10 loop select the_name from the_table into myvar where the_id = i ; end loop; DBAndre -Original Message- From: Andrey Bronfin Sent: Thu, April 04, 2002 9:50 PM To: [EMAIL PROTECTED] (E-mail); [EMAIL PROTECTED] (E-mail); oralist@lists (E-mail) Subject: a PL/SQL question - how to catch errors without going into exceptions block Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Brian McGraw INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: a PL/SQL question - how to catch errors without going into ex
Hi Audrey, Try this, it will stay in the loop i := 1; while i 10 loop for j in (select the_name from the_table into myvar where the_id = i) loop . end loop; end loop; . Hope it helps. Regds, Catherine -Original Message- From: Andrey Bronfin [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 2:44 AM To: Multiple recipients of list ORACLE-L Subject:a PL/SQL question - how to catch errors without going into except Dear gurus ! I'm wondering whtether i can catch an SQL error (from inside a PL/SQL proc) without jumping to the EXCEPTION block OR is there a way to jump back to the body of the proc from the EXCEPTION block (i know that GOTO can not do it). For example , assume i have users with IDs 1,2,5,6 in my table and i want to do some loop like this i := 1; while i 10 loop select the_name from the_table into myvar where the_id = 1; end loop; . I will be thrown to the EXCEPTION block as soon as i becomes 3. And i can never go back to the loop from the EXCEPTION block , in order to continue looping ;-( So , can i just tell PL/SQL something like never mind if U fail (i.e. an exception is thrown) , just go to the next iteration ... I'm wondering if there is something similar to PERL's next if . Thanks a lot Andre -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Andrey Bronfin INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: CHAN Chor Ling Catherine (CSC) INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).