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 / ramprasad.s

Hi Anaswer to your question
IS

declare
cursor C1 is select ENAME,SAL,COMM from EMP;
begin
For i IN C1 loop
IF i.comm > 299 AND i.comm < 999 then
dbms_output.put_line(i.ENAME || ' ' || '** Good
commission');
ELSIF i.comm >999 then
dbms_output.put_line(i.ENAME || ' ' || '** Very Good
commission');
ELSE
dbms_output.put_line(i.ENAME || ' ' || NVL(COMM,0));
END IF;
END LOOP;
END;

sun_ramprasad@yahoo.com

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many sql statements are used?

743


Can I copy :old and :new pseudo-records in/to an oracle stored procedure?

869


What is auto increment?

733


How to Declare Fixed Length String Value In PL SQL

843


How to pronounce postgresql?

759






Explain the difference between 'between' & 'and' operators in sql

722


What is a constraint? Tell me about its various levels.

838


What are different types of functions in sql?

723


What does count (*) mean?

680


Can we insert in sql function?

772


What is a column in a table?

769


What is a boolean in sql?

702


What is integrity in sql?

750


Can we use the cursor's to create the collection in PL/SQL?

694


What are inner outer left and right joins in sql?

727