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 / radha sri seshu.kolla

WHEN YOU ARE USING CURSOR WIH FOR LOOP NO NEED TO SPECIFY
CLOSE CURSOR.
SINGLE CORES ARE LOOKING AS IF THEY ARE SINGLE CORES, BUT
THEY ARE SPECIAL CHARACTERS.
YOU ARE USIGN NVL FUNCTION IN THIS. YOU GAVE FIRST ARGUMENT
AS NUMBER DATATYPE, AND SECOND IS CHARACTER DATA TYPE. 0
AND O LOOK LIKE SAME JUST IT IS TO CONFUSE THE CANDIDATES.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the subsets of sql?

750


Can we use delete in merge statement?

729


What is the use of double ampersand (&&) in sql queries? Give an example

807


What is difference between db2 and sql?

719


How many postgresql users are there, worldwide?

775






What is a constraint?

729


How to add new employee details in an employee_details table with the following details

821


What is a relationship and what are they?

779


Mention what is the function that is used to transfer a pl/sql table log to a database table?

661


Which column of the user triggers data dictionary view displays the database event that will fire the trigger?

770


What is auto increment feature in sql?

817


how to create a new table by selecting rows from another table in mysql? : Sql dba

746


What is rank dense_rank and partition in sql?

748


What do you mean by stored procedures? How do we use it?

712


How exception is different from error?

761