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 to add a column ‘salary’ to a table employee_details?

594


what is the difference between rownum pseudo column and row_number() function? : Sql dba

620


name 3 ways to get an accurate count of the number of records in a table? : Sql dba

572


What are the ddl commands?

537


What does closing a cursor do?

767






What are triggers and its uses?

595


Sql technical questions

778


What are data types in pl sql?

564


What is prepared statement in sql?

548


What is the primary key?

538


Explain the rollback statement?

579


what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba

673


what is bdb (berkeleydb)? : Sql dba

574


Which command is used to call a stored procedure?

505


How do I make my sql query run faster?

470