Table Has C1 And C2 Column If Exits any record in c1 then
Update c2 record Otherwise insert new record in the C1 And
C2 (Using Procedure)
Answer Posted / senthilkumar
create or replace procedure update is
declare
cursor updt is
select cl from table;
num number(4);
begin
open updt;
fetch updt into num;
if num != NULL
then
update table set c2 = num or(desired data);
else
insert into table values(value,value);
exception
when others then
DBMS_OUTPUT.PUT_LINE('SQLERR'|| ''||SQLERRM);
end;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which environment variables are absolutely critical in order to run the OUI?
What is oracle host variable?
What happens if variable names collide with table/column names?
Which dictionary tables and/or views would you look at to diagnose a locking issue?
What is the implicit cursor in oracle?
Difference between cartesian join and cross join?
How to retrieve the count of updated rows?
What is a data dictionary and how can it be created?
What is max rowid in oracle?
How to save query output to a local file?
what is difference between sql plus and sql*plus? (not sql and sql plus).
How data locks are respected in oracle?
What privilege is needed for a user to create views in oracle?
How to create a new user account in oracle?
How to see free space of each tablespace?