using cursors salesman get bonus as 10% of their salary ,
managers get 20% , analalist get 30%. generae a report
showing the employee name, salary , bonus.
Answer Posted / neelaveni
declare
/*cursor c_bonus
is
select * from empsal; */
begin
for i in (select * from empsal)
loop
if i.job='salesman' then
i.bonus:=i.sal*10/100;
elsif i.job='mgr' then
i.bonus:=i.sal*20/100;
elsif i.job='analyst' then
i.bonus:=i.sal*30/100;
end if;
dbms_output.put_line('The ename is : '||i.ename);
dbms_output.put_line('The sal is : '||i.sal);
dbms_output.put_line('The job is : '||i.job);
dbms_output.put_line('The bonus is : '||i.bonus);
end loop;
end;
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
what is the difference between where clause and having clause? : Sql dba
What are actual parameters and formal parameters?
How to start oracle sql developer?
Is there any restriction on the use of union in embedded sql?
what is the stuff function and how does it differ from the replace function? : Sql dba
Can we join same table in sql?
what is try_catch block in procedure
What is a unique constraint?
What are aggregate and scalar functions?
How many types of cursors supported in pl/sql?
What is a join?
How do I view a table in sql?
List the various privileges that a user can grant to another user?
What is delete command in sql?
How do I create an index in word?