View Single Post
  #3 (permalink)  
Old 11-27-2007, 08:43 AM
anna_2k2 anna_2k2 is offline
Junior Member
 
Join Date: Nov 2007
Posts: 2
anna_2k2 is on a distinguished road
Default ANY answer. Re: cursor based thread

errors in comments
Declare
Cursor C1 is select ename, sal, comm from emp;
--c1 declaration does not contain empno but you used it in elseif clause.that is wrong.
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');
-- i.empno is not declared

close C1;

--cursor is closed so you can not reference i which is implicitly declared based on cursor row.so the else clause DOPL statement will through errors
Else

Dbms_output.put_line(i.Ename || ' ** ' ||nvl(i.comm,'O'));

End if;
--- there is no exit clause

End Loop;
End;
so these are all the errors you will get.
and it looks as if this is a ocp exam question am i right?
Reply With Quote