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

what is a cursor? : Sql dba

642


The in operator may be used if you know the exact value you want to return for at least one of the columns.

634


How do you take the union of two tables in sql?

604


Is pl sql a programming language?

632


How we can update the view?

686






Explain what is a database?

730


how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

731


What is pl sql record in oracle?

650


What is nvarchar in sql?

606


What is posting?

685


What does rownum mean in sql?

638


How do I order by ascending in sql?

638


what are sequences

1208


what is rollback? : Sql dba

672


how to use myisamchk to check or repair myisam tables? : Sql dba

601