Home » SQL & PL/SQL » SQL & PL/SQL » Help!!!!...Error with a Simple Cursor
icon9.gif  Help!!!!...Error with a Simple Cursor [message #356679] Fri, 31 October 2008 23:09 Go to next message
ghost25
Messages: 2
Registered: October 2008
Junior Member
Hi,

I am working with a table named emp2 with 2 columns...ename and mname.

The following is the block which i have written for creating a cursor

-----------------------
DECLARE
v_ename emp2.ename%TYPE;
v_mname emp2.mname%TYPE;

CURSOR ename_cursor IS
SELECT ename,mname FROM emp2;

BEGIN
OPEN ename_cursor;
FOR i IN 1..5 LOOP
FETCH ename_cursor INTO v_ename, v_mname;
DBMS_OUTPUT.PUT_LINE(v_ename || ' ' || v_mname);
END LOOP;
END;
/
-----------------------

Its a fairly simple snippet...but i keep getting error saying

***************
SQL> @ c:\test\cursor\cur_declar.sql
OPEN ename_cursor;
*
ERROR at line 9:
ORA-06550: line 9, column 7:
PLS-00103: Encountered the symbol "ENAME_CURSOR" when expecting one of the
following:
:= . ( @ % ; not null range default character
ORA-06550: line 14, column 4:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
pragma
***********************

can someone tell me what i am doing wrong

Thanks in Advance
Ghost25

[Updated on: Fri, 31 October 2008 23:35]

Report message to a moderator

Re: Help!!!!...Error with a Simple Cursor [message #356682 is a reply to message #356679] Fri, 31 October 2008 23:40 Go to previous messageGo to next message
ghost25
Messages: 2
Registered: October 2008
Junior Member
got it figured out....thanks anyway
Re: Help!!!!...Error with a Simple Cursor [message #356695 is a reply to message #356682] Sat, 01 November 2008 02:44 Go to previous message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Before posting next time, please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.

Also it is a fair and appreciated practice to post the solution or reason of error you found for those that come after and read your topic.

Regards
Michel
Previous Topic: how to copy a record type's values to a object type
Next Topic: with clause query
Goto Forum:
  


Current Time: Fri Dec 09 05:41:47 CST 2016

Total time taken to generate the page: 0.05028 seconds