Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to Determine Whether to Insert or Update
Hi,
You could always use the implicit cursor sql to determine how many rows were updated and if none were, insert one :
update CHILD set -- whatever
where PARENT_ID = P_ID and ORDERING = P_ORDERING;
if sql%rowcount = 0 then
insert into CHILD (PARENT_ID, ORDERING)
values (P_ID, ORDERING);
end if;
Ben. Received on Mon Mar 14 2005 - 04:25:00 CST