使用Cursor值更新表列

时间:2014-02-05 08:48:14

标签: sql oracle plsql cursor sql-update

你好我的游标有问题我在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))));

它出错了:

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

我完全不明白你能帮忙指出问题是什么

1 个答案:

答案 0 :(得分:0)

我认为错误发生在游标本身,因为SITE_ID未在游标中添加为列。我添加了它,问题解决了。