Re: cursor question

From: Paul Dorsey <pdorsey_at_dulcian.com>
Date: 2000/01/30
Message-ID: <yK2l4.11957$t_.263999_at_news.rdc1.nj.home.com>#1/1


The idea is to use an anonymous PL/SQL block that traps the error and ignores it.
See below for the modified code:

May I recommend that you buy Steve Feuerstein's book on PL/SQL programming. It has many great tips that will help you in situations like this.

--
Paul Dorsey
Dulcian, Inc.
(212) 595-7223
web address: http://www.dulcian.com
email: pdorsey_at_dulcian.com


Jorge Torralba <torralba_at_europa.com> wrote in message
news:3894A7A6.7067F1DF_at_europa.com...

> In the following cursor, if the exception is encountered, the sql
> termnates. How can I do a continue loop in order for the process to
> continue with the next value ?
>
> Thanks,
>
> JT
>
>
> DECLARE
> v_rialto_id varchar2(12);
> v_newval number;
> v_counter number;
> CURSOR C1 IS SELECT RTRIM(rialto_id) FROM ibl_rialto_doc_log FOR
> UPDATE;
> BEGIN
> v_counter := 0;
> OPEN C1;
> LOOP
---create the anon block within your main procedure begin
> v_counter := v_counter + 1;
> FETCH C1 INTO v_rialto_id;
> SELECT newval INTO v_newval FROM rialto_val
> WHERE RTRIM(oldval) = RTRIM(v_rialto_id);
> UPDATE ibl_rialto_doc_log
> SET rialto_id = TO_CHAR(v_newval)
> WHERE CURRENT OF C1;
> IF v_counter = 100 THEN
> COMMIT;
> v_counter := 0;
> exit;
> END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN null; end; ---of anon block
> END LOOP;
> > -- if it reaches this i want it to continue from the top with the next
> value in c1.
> NULL;
> END;
> /
>
> --
> Jorge Torralba
> SMG Applications Group
>
> Intel
> 5200 N.E Elam Young parkway
> JF1-18
> Hillsboro OR, 97124
> (503) 712-1731
> Jorge.Torralba_at_Intel.com
> ----------------------------------------------------------------
> Any views or opinions expressed by me do not reflect those
> of Intel Corp.
>
>
Received on Sun Jan 30 2000 - 00:00:00 CET

Original text of this message