Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error while using cursor : 'Encountered the symbol "end-of-file" when expecting one of the followin

037819c4-373c-4ac8-9368-d8c4f28c5250Dec 21 2015 — edited Dec 21 2015

Hi All,

I am trying to do a mass updated to all the columns in the below table by using a cursor

& using the sql query mentioned below

But I keep getting an error --> Encountered the symbol "end-of-file" when expecting one of the following: ;


PERSONIDLASTNAMEFIRSTNAMEADDRESSCITY
11Tom B. ErichsenSkagen 21StavangerNorway
22Joe B. ErichsenSkagen 21Stavangerminneapolis
33Mary B. ErichsenSkagen 21StavangerNorway

QUERY USED

DECLARE
CURSOR Cursor IS SELECT * FROM Persons;
myVar  Cursor%ROWTYPE;

BEGIN
OPEN Cursor;

LOOP

FETCH Cursor INTO myVar;
EXIT WHEN Cursor%NOTFOUND;
UPDATE Persons SET LastName='Name:'|| persID WHERE LastName=myVar.LastName and persID=mVar.PersonID ;

END LOOP;

CLOSE Cursor;
END;

My Expected Result  is:

PERSONIDLASTNAMEFIRSTNAMEADDRESSCITY
11Name:11Skagen 21StavangerNorway
22Name:22Skagen 21Stavangerminneapolis
33Name:33Skagen 21StavangerNorway
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2016
Added on Dec 21 2015
4 comments
423 views