RE: pl/sql question

RE: pl/sql question

 

  

Here is the method I use.


FOR rec in messages_opened
LOOP
--
l_rows := l_rows + 1;
--
UPDATE BV.ATO_RAW_MESSAGE_SENT
set messages_opened = 1
where user_id = rec.user_id
and message_instance_id = rec.message_instance_id;
--
if SQL%FOUND then
UPDATE BV.ATO_RAW_MESSAGE_OPEN
set state = 2
where rowid = rec.rowid;
else
UPDATE BV.ATO_RAW_MESSAGE_OPEN
set state = 5
where rowid = rec.rowid;
end if;
--
if MOD(l_rows, l_commit_freq) = 0 then
COMMIT;
end if;
--
END LOOP;
COMMIT;



-----Original Message-----
From: Carlos Barrera
[mailto:oracledba-ezmlmshield-x40769484.[Email address protected]
Sent: Wednesday, April 06, 2005 10:24 AM
To: LazyDBA Discussion
Subject: pl/sql question



the following code is not working properly. when the record doesn't exist,
it's not inserting it. do i have to use another exception instead of
no_data_found?

regards.

begin
update table a
set ...
where...
exception when no_data_found then
insert into table a ...
end;
commit;





--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html

Oracle LazyDBA home page