我有一个varray定义为:
declare
TYPE tnr_l IS VARRAY(30) of lve%ROWTYPE;
我希望使用从数据库中获取的内容来初始化此varray:
select * into tnr_l from lve where type = 'TNR' order by value;
但这失败了:
.ORA-06550: line 6, column 23:
PLS-00321: expression 'TNR_L' is inappropriate as the left hand side of an
assignment statement
我该如何工作?
最佳答案
您需要声明类型为tnr_l的变量,然后需要在select中使用bulk collect
,例如以下示例:
declare
type t_dept is varray(100) of dept%rowtype;
l_dept t_dept;
begin
select * bulk collect into l_dept from dept;
for i in 1..l_dept.count loop
dbms_output.put_line(l_dept(i).dname);
end loop;
end;
关于oracle - 如何初始化{TABLE}%ROWTYPE的varray表?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4122469/