Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> cursor question
Hi All!
I have a question concerning doing a checking on a table whether or not a string value already exists before doing an insertion in it through a cursor. This insertion has to be done within a nested loop where in the outer loop another insertion is being done into another separate table.
Something like given below (which doesn't and shouldn't work by the way as
SQL%NOTFOUND goes with select-into not just select as it is written)--
....
begin
open primary_mod; while primary_mod%found loop fetch primary_mod into string1, modula; insert into mod values (string1, modula); open primary_trans; while primary_trans%found loop fetch primary_trans into string2; select primary_str from translation where primary_str=string2; if SQL%NOTFOUND then insert into translation (primary_str, trans_str) values (string2, string2); end if; end loop; close primary_trans; end loop; close primary_mod; commit;
Would appreciate if someone could help me out.
Thanking you in advance.
Tariq Ahsan
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Wed Apr 29 1998 - 00:00:00 CDT
![]() |
![]() |