-
Plzz Help
Hi,
I need to check for the existence of record in a table for certain conditions if the record exits just update some muneric columns if it does not exists insert it
can u send me the query on this
Thanks all in advance
Anupama
anu
-
Hi
One way would be to do
declare
begin
--do the update
update table
set col1=some_value
where col2=some_condition; --based on some criteria
--check wheather u updated any rows
if sql%rowcount=0 then
--do nothing
NULL;
else
insert into tables
values(some_value);
end if
end;
regards
Hrishy
Last edited by hrishy; 03-04-2004 at 06:15 AM.
-
Hi,
Here is the Pseudocode, which u can try
----------------
Procedure Populate_Target_table
Cursor c1 is selet * from Target_Table
MINUS
select * from Source Table
for x in c1 loop
Insert into Target_Table
By taking data from cursor;
Exception
Dup_val_on index
Update Target_table
You need to have a primary key for this to work
-
-
Thanks all for your help the problem is solved
anu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|