Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> PL/SQL experts, Please help solve..
I need your help !
I have the following tables: table1, table2 . My cursor read
table1 and insert in table2 with a values based on the folowing criterion:
table2 is empty.Using cursor the first record 'aa' is read and
insert into table2. if the following records are the same as the first record
no insertion in table2.The tricky part is if the the values of records which
has already been read and inserted into table2 appears again after other
records are read then , all those records will be flagged in table1 as 'Y'in
table1 column fag i.e that is, table1 flag column will be
updated with the value of 'Y'. the same rules applies for all records. In
other words always the cursor has to check for values in table2 to validate
the values. The tables and the final outputs looks as follows
note : table1 colmn flg is all null before update.
select * from table1;
col1 flg
aa
aa
aa
bb
bb
aa Y aa Y
table table2
col1
aa
bb
cc
these errorr ecords in table1 row 6 ,7 and 9th
I can populate table2 col1 values, but I can't flag errors in table1
hint
for x in (select * from table1 ) loop
begin
update table2
etc. etc.
if (sql%rowcount = O ) then
insert into table1 values (x.col1) etc but I cant not flag in table1
please help!!!
Mohamed Yusuf
myusuf1_at_followme.com
Toronto
thanks in advance
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Tue May 26 1998 - 21:20:05 CDT