有表table1 含字段id等;有个记录表,如下
TYPE TBL_TYPE IS TABLE OF table1%ROWTYPE INDEX BY PLS_INTEGER;
TB TBL_TYPE; 给TB赋值
SELECT * BULK COLLECT INTO TB FROM table1;这时我想将TB中的id列和其它表进行关联查询,请问怎么写
如
select count(1) into i from table2,(TB中的id列集合) z
where table2.id=(TB中的id)
上面括号中的地方该怎么写呢?
TYPE TBL_TYPE IS TABLE OF table1%ROWTYPE INDEX BY PLS_INTEGER;
TB TBL_TYPE; 给TB赋值
SELECT * BULK COLLECT INTO TB FROM table1;这时我想将TB中的id列和其它表进行关联查询,请问怎么写
如
select count(1) into i from table2,(TB中的id列集合) z
where table2.id=(TB中的id)
上面括号中的地方该怎么写呢?
select count(1) into i from table2,(SELECT ID FROM TABLE(CAST TB AS TBL_TYPE)) z
where table2.id=(Z.ID)
where table2.id in (select id from TB)//也就是你的id的集合
where table2.id =TB.id)