PL/SQL (MOSC)

MOSC Banner

How to update/insert the table if cursor returns 0 records?

edited Apr 6, 2021 4:29AM in PL/SQL (MOSC) 3 commentsAnswered

Hello All,

Oracle DB Version: 11.2.0.1

we have a requirement where there is no record in the cursor then it should update/insert the table with that record(s). Please find below the scripts for the same,

Create table:

create table table_a(emp_id number,emp_name varchar2(50))

/

create table table_b(emp_id number,dept_id number, dept_name varchar2(50))

/

create table table_c(process_flg varchar2(3),description varchar2(1000),emp_id number,emp_name varchar2(50),dept_id number,dept_name varchar2(50))

/

Insertion scripts:

insert into table_a values (1,'ABC1')

/

insert into table_a values (2,'ABC2')

/

insert into table_a values (3,'ABC3')

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center