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


Please Help Members By Posting Answers For Below Questions

What is normalization in a database?

715


How to place comments in pl/sql?

711


what is an execution plan? When would you use it? How would you view the execution plan? : Sql dba

636


What is a database event trigger?

690


What is the best partition size for windows 10?

607






What is acid property in a database?

671


what is a trigger in mysql? Define different types of trigger. : Sql dba

651


is it possible to pass an object or table to a procedure as an argument?

689


What is pl sql commands?

648


What are the different sql languages?

646


Explain the difference between rename and alias?

644


What are the types of queries in sql?

626


Mention what is the plv (pl/vision) package offers?

737


What is sql*loader and what is it used for?

670


what happens if null values are involved in expressions? : Sql dba

657