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


Please Help Members By Posting Answers For Below Questions

Is there any way to find out when one specific table/view/M-view is used last time. i.e. when one specific object is used in any SELECT statement.

1079


Whats the benefit of dbms_stats over analyze?

1706


Describe an oracle table?

798


What is a snapshot in oracle database?

774


What is an oracle recycle bin?

725


What is oracle latest version?

844


various types of hints and their usage

2376


How to open and close an explicit cursor in oracle?

795


How to get a create statement for an existing table?

754


Which is better Oracle or MS SQL? Why?

4423


How to pass parameters to procedures?

758


State the difference along with examples between Oracle 9i, Oracle 10g and Oracle 11i.

796


Can we create database in oracle using command line ?

814


Whether any commands are used for months calculation? If so, what are they?

841


How to convert times to characters in oracle?

804