Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

INSERT INTO SELECT issue

$
0
0
I have a scenario where in i should achieve the below.

if (bonusflag=FALSE)
insert into emp_sal select emp_no , no_of_hours*60 as emp_sal from emp
where no_of_hours = 4

IF(bonusflag=TRUE)
insert into emp_sal select emp_no , (no_of_hours*60) + 5000 as emp_sal from emp where emp_no >100 and no_of_hours > 6

Now, while doing the same thru pl/sql can you help me how to write the code as we can not use execute immediate because the above queries will return more than 1 row.

Thanks..

Viewing all articles
Browse latest Browse all 13329

Trending Articles