例:1,2,3のように2000個のエントリを持っている一つの列「ID」とテーブル「ID_NAME」がある... 2000年 私はID_NAMEどこIDからの問合せORACLEのSQLクエリの結果セットを格納する方法?
選択IDを持っていました<1001;
> Result : 1 2 3 4 . .1000
私のPL SQLブロックは、次のようになります
SET SERVEROUTPUT ON;
declare
var1 number;
var2 number;
var3 number;
var4 number;
var5 number;
var6 number;
var7 number;
var8 number;
var9 number;
var10 number;
begin
with set1 as (select id from ID_NAME where id < 1001)
select count(*) into var1 from table1 where id in (select * from set1);
select count(*) into var2 from table2 where id in (select * from set1);
select count(*) into var3 from table3 where id in (select * from set1);
select count(*) into var4 from table4 where id in (select * from set1);
select count(*) into var5 from table5 where id in (select * from set1);
select count(*) into var6 from table6 where id in (select * from set1);
select count(*) into var7 from table7 where id in (select * from set1);
select count(*) into var8 from table8 where id in (select * from set1);
select count(*) into var9 from table9 where id in (select * from set1);
select count(*) into var10 from table10 where id in (select * from set1);
DBMS_OUTPUT.PUT_LINE('var1,var2,var3,var4,var5,var6,var7,var8,var9,var10');
DBMS_OUTPUT.PUT_LINE(var1||','||var2||','||var3||','||var4||','||var5||','||var6||','||var7||','||var8||','||var9||','||var10);
end;
が、私は
PL/SQL取得しています。ORA-00942:表またはビューが
存在しません。
私のSQL開発者です。
私は数に何度も何度もそれを実行する必要がないように私のクエリの下からSET1を使用したい(*)サブ
with set1 as (select id from ID_NAME where id < 1001)