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

How to get unique records from a table?

679


What is inner join in sql?

768


What is java sql driver?

733


What is data profiling in sql?

733


What is the difference between a database and a relational database?

761






Can ddl statements be used in pl/sql?

791


What are the different operators available in sql?

743


Explain correlated query work?

788


What is trigger and how to use it in sql?

723


What is sqlservr exe?

683


what are the authentication modes in sql server? : Sql dba

727


how can we find the number of rows in a table using mysql? : Sql dba

787


Can a varchar be a primary key?

692


What are the basic sql commands?

739


What is informix sql?

725