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
What is nvarchar max in sql?
What is the use of primary key?
How to fetch values from testtable1 that are not in testtable2 without using not keyword?
Can we create clustered index without primary key?
What is vector point function?
Lookups are a key component in sql server integration services (ssis). Explain its purpose?
What is trigger and how to use it in sql?
What is the plv (pl/vision) package offers?
what is the difference between primary key and unique key? : Sql dba
What is sql query optimization?
Mention what is the use of function "module procedure" in pl/sql?
Explain the the delete statements in sql?
What are the different operators available in sql?
Can we create foreign key without primary key?
Explain spool.