定义 v_id_rec int_tb := int_tb(); ************************************ 作成 for v_data in cur_1 loop v_id_rec.extend; v_id_rec(v_id_rec.count) := v_data.id; end loop;************************************ 使用 select column_value from table(v_id_rec)
用TYPE保存,如我的一个TYPE CREATE OR REPLACE TYPE caca_xsj_str_split IS TABLE OF VARCHAR2 (4000);
楼主可以在查询的字段上加上rownum这一列,用number类型的变量存起来,例如: select id,name,rownum from emp ;
DECLARE TYPE ABC IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; X ABC; BEGIN X(1) := 1; X(2) := 2; X(3) := 3; --other operation END; / 这不就报存到数组了吗?
create or replace procedure save_procedure is type save_data is table of dution_name%type index by binary_integer; save save_date; begin for i in 1.. 10 loop select id,name into save[i] from table_name where id=i; end loop; end;
v_id_rec int_tb := int_tb();
************************************
作成
for v_data in cur_1 loop v_id_rec.extend;
v_id_rec(v_id_rec.count) := v_data.id;
end loop;************************************
使用
select column_value from table(v_id_rec)
CREATE OR REPLACE TYPE caca_xsj_str_split IS TABLE OF VARCHAR2 (4000);
select id,name,rownum
from emp ;
DECLARE
TYPE ABC IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
X ABC;
BEGIN
X(1) := 1;
X(2) := 2;
X(3) := 3;
--other operation
END;
/
这不就报存到数组了吗?
is
type save_data is table of dution_name%type index by binary_integer;
save save_date;
begin
for i in 1.. 10 loop
select id,name into save[i] from table_name where id=i;
end loop;
end;