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 / umadevi

Declare
Cursor C1 is select empno, 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');
Else
Dbms_output.put_line(i.Ename || '**
' || ( i.comm||','||'O'));
End if;
End Loop;
End;
/

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I order by ascending in sql?

542


Can you do multiple joins in sql?

550


What is sql used for?

647


how to calculate expressions with sql statements? : Sql dba

532


What are the built in functions of sql?

571






What are the advantages of sql?

562


What are different types of functions in sql?

513


Define SQL and state the differences between SQL and other conventional programming Languages?

692


What are the advantages of normalization?

560


how would you get the current date in mysql? : Sql dba

553


What is an escape character in sql?

567


Why procedure is used in sql?

537


what is union, minus and interact commands? : Sql dba

668


Explain how can you save or place your msg in a table?

597


Where is sql database stored?

520