adspace


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

Can delete statement be rollbacked?

1061


what is collation? : Sql dba

1235


how to start mysql server? : Sql dba

1275


Can we rollback truncate?

1080


what is bcp? When does it used? : Sql dba

1063


What is the current version of sql?

1100


define sql insert statement ? : Sql dba

1104


how many tables will create when we create table, what are they? : Sql dba

1151


What is the current version of postgresql?

1185


Do we need to rebuild index after truncate?

1149


Is primary key always clustered index?

1101


how to escape special characters in sql statements? : Sql dba

1122


what is sql server agent? : Sql dba

1186


what are the advantages of sql ? : Sql dba

1148


How do I remove duplicates in two columns?

1198