Re: cursor question
From: Mitsunori Ishikawa <ishikawa_at_metrosystems.co.jp>
Date: 2000/01/31
Message-ID: <872t8q$399nl$1_at_fu-berlin.de>#1/1
Date: 2000/01/31
Message-ID: <872t8q$399nl$1_at_fu-berlin.de>#1/1
How about to use another cursor c2?
It doesn't occur exception no_data_found for the select statement.
See below for the modified code:
Other way, you modify cursor c1 including to select newval from rialto_val. LIKE THIS: cursor c1 is select newval from ibl_rialto_doc_log i,rialto_val r
where rtrim(i.rialto_id) = rtrim(r.rialto_id) for update of ibl_rialto_doc_log.rialto_id ;
-- Mitsunori Ishikawa Jorge Torralba <torralba_at_europa.com> wrote in message news:3894A7A6.7067F1DF_at_europa.com...Received on Mon Jan 31 2000 - 00:00:00 CET
> 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;
cursor c2 is select newval into v_newval from rialto_val where rtrim(oldval) = rtrim(v_rialto_id);
> BEGIN
> v_counter := 0;
> OPEN C1;
> LOOP
> v_counter := v_counter + 1;
> FETCH C1 INTO v_rialto_id;
--comment out> SELECT newval INTO v_newval FROM rialto_val --comment out> WHERE RTRIM(oldval) = RTRIM(v_rialto_id); open c2; fetch c2 into v_newval; if c2%found then > UPDATE ibl_rialto_doc_log > SET rialto_id = TO_CHAR(v_newval) > WHERE CURRENT OF C1; end if; close c2;
> IF v_counter = 100 THEN
> COMMIT;
> v_counter := 0;
> exit;
> END IF;
> END LOOP;
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> -- 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.
>
>