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

Enlist the advantages of sql.

559


What is a primary key? Explain

531


What is PL/SQL Records?

616


What are string functions in sql?

667


What do you understand by pl/sql records?

524






Can you have a foreign key without a primary key?

505


What are the sql aggregate functions?

599


How to Execute a Package in PL/SQL.?

570


how would you enter characters as hex numbers? : Sql dba

507


What are the benefits of pl sql?

518


how to create a new view in mysql? : Sql dba

486


What is cursor and why it is required?

543


What is cartesian join in sql?

549


Which data dictionary views have the information on the triggers that are available in the database?

741


What is record data type?

505