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 do you declare a user-defined exception?

631


What is optimistic concurrency control? : Transact sql

631


What are the advantages of pl sql?

719


What is data profiling in sql?

632


What is the usage of when clause in trigger?

652






What is a boolean in sql?

617


How delete a row in sql?

626


List the various privileges that a user can grant to another user?

668


How do you modify a trigger?

612


what is a composite primary key ? : Sql dba

675


i have 2 table table one 4 columns respective values a1 7,a2 6,a3 8 ,a4 12 & table two 4 colums respective values a1 7,a2 6,a3 8,a4 15.if table one & table two 3 colums same then 4th column values 1)Qes diff >5 then print 5 * diff value 2)Que diff <5 print 5

3405


Can we commit in trigger?

630


What is a unique constraint?

685


Why select is used in sql?

603


What do you understand by pl/sql cursors?

648