简体   繁体   中英

update table column with Cursor value

Hello I have a problem with cursors here I have this code in my PL/SQL

update CAND_ORDER SET SOURCE_SITE_ID = i.SITE_ID WHERE CAND_ORDER_ID IN
(select CAND_ORDER_ID from CAND_ORDER where SOURCE_SITE_ID is null and SP_TRIAL_MATERIAL_ID in 
(select SP_TRIAL_MATERIAL_ID from SP_TRIAL_MATERIAL where SP_RESEARCH_STATION_ID_SOURCE IN 
(select SP_RESEARCH_STATION_ID from SP_RESEARCH_STATION where SP_RESEARCH_STATION.CODE IN 
(SELECT SITE_CODE from SITE WHERE SITE.SITE_CODE=i.SITE_CODE))));

it gives an error saying:

PLS-00302: component 'SITE_ID' must be declared
ORA-06550: line 17, column 44:
PL/SQL: ORA-00904: "I"."SITE_ID": invalid identifier

which I totally do not understand would you please help pointing what is the problem

I think that the error was in the cursor itself as SITE_ID was not added in the cursor as column. I added it and the problem was solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM