Dear All,



Question for this Week



Find out possible error(s) (either at compile
time or at runtime) in the following PL/SQL block. State
the reason(s) and correct the errors.



Declare

Cursor C1 is select ename, sal, comm from emp;

Begin

For i in C1 Loop

If i.comm between 299 and 999 then

Dbms_output.put_line(i.Ename || ‘
** Good Commission’);

Elsif i.comm > 999 then

Dbms_output.put_line(i.Empno || ‘
** Very Good Commission’);

close C1;

Else

Dbms_output.put_line(i.Ename || ‘
** ’ ||nvl(i.comm,‘O’));

End if;

End Loop;

End;

Answer Posted / ganesh sawant from finacle

It will run and will give o/p
*******************************************
set serveroutput on
declare
Cursor C1 is select A_no, A_name from ABC;
Begin
For i in C1 Loop
If i.A_no between 10 and 20 then
Dbms_output.put_line(i.A_name || '** Good Commission******');
Elsif i.A_no > 2000 then
Dbms_output.put_line(i.A_name || '** Very Good Commission##########');
close C1;
Else
Dbms_output.put_line(i.A_name || '&&&&&& ' ||nvl(i.A_name,'O'));
End if;
End Loop;
End;
===========
PL/SQL procedure successfully completed.

RAJ** Good Commission******
RAJ** Good Commission******
RAJ** Good Commission******
RAJ** Good Commission******
BABA** Good Commission******

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I run a pl sql procedure in sql developer?

503


Why plvtab is considered as the easiest way to access the pl/sql table?

606


What is interval partition?

537


What is the difference between union and union all command?

540


What is a temporal table?

483






What is delete command in sql?

545


What does stand for in sql?

513


what is 'mysqlcheck'? : Sql dba

563


Enlist some predefined exceptions?

570


What programs use sql?

517


What is secondary key?

504


what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba

544


What are the two types of exceptions.

626


How to get help at the sql prompt?

631


How to add new employee details in an employee_details table with the following details

637