[英]PLS-00201: identifier 'TYR' must be declared
I'm having a problem when trying to populate two tables with one cursor. 尝试使用一个游标填充两个表时出现问题。 It's the Term table and the time table.
这是术语表和时间表。 below is the code.
下面是代码。 Any help would really appreciated.
任何帮助将不胜感激。 Thanks
谢谢
PS: I have created create sequence dw_time_seq; PS:我已经创建了创建序列dw_time_seq; and create sequence dw_term_seq;
并创建序列dw_term_seq;
declare
Cursor c_term is
select temprequestid, termdate, status, tempid, tempcoverid
from term;
begin
for c_rec in c_term loop
insert into dw_term values(
dw_term_seq.nextval,
c_rec.temprequestid,
c_rec.termdate,
c_rec.status,
c_rec.tempid,
c_rec.tempcoverid
);
insert into dw_time values(
dw_time_seq.nextval,
c_rec.tdate,
c_rec.tweek,
c_rec.tmonth,
c_rec.tyear
);
end loop;
end;
Assuming the error is PLS-00201: identifier 'TYEAR' must be declared
, remove the c_rec.
假设错误是
PLS-00201: identifier 'TYEAR' must be declared
,然后删除c_rec.
part of c_rec.tyear
. c_rec.tyear
一部分。 tyear
is a local variable, not a field in the cursor. tyear
是局部变量,而不是游标中的字段。
Proably, the error you get is - in contradiction to the post's title - PLS-00201: identifier 'TYEAR' must be declared
. 确实,您得到的错误是- 与帖子标题
PLS-00201: identifier 'TYEAR' must be declared
。 This is because the variable tyear
hadn't been declared. 这是因为尚未声明变量
tyear
。 Declare it like so 这样声明
declare
tyear number;
cursor c_term is ...
Also, the part reading c_rec.tyear
should then of course just be this variable tyear
instead. 另外,读取
c_rec.tyear
的部分当然应该只是该变量tyear
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.