我正在尝试通过使用游标和放大器对下表中的所有列进行批量更新。使用下面提到的SQL查询
但我一直收到错误
在遇到以下其中一项时遇到符号“文件结束”:;
PERSONID LASTNAME FIRST ADDRESS CITY
11 Erichsen Skagen 21,Stavanger Norway
22 Erichsen1 Skagen 22,Stavanger Minneapolis
33 Erichsen2 Skagen 33,Stavanger Norway
使用的查询:
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;
我的预期结果是:
PERSONID LASTNAME FIRST ADDRESS CITY
11 Name:11 Skagen 21,Stavanger Norway
22 Name:22 Skagen 22,Stavanger Minneapolis
33 Name:33 Skagen 33,Stavanger Norway