------解决方案-------------------- CREATE GLOBAL TEMPORARY TABLE temp_1 (a INT);
CREATE OR REPLACE PROCEDURE p_test IS l_i INT; BEGIN INSERT INTO temp_1 VALUES(2); SELECT COUNT(*) INTO l_i FROM temp_1; dbms_output.put_line(l_i); END; /
BEGIN p_test; END; /
输出: 1
------解决方案--------------------
SQL code
/--给个例子,试一下:
create table SSS
(
ID NUMBER,
VALUE1 NUMBER
)
insert into sss values(1,2);
CREATE OR REPLACE PROCEDURE BBBB(PO_RESULT OUT SYS_REFCURSOR) IS
BEGIN
execute immediate 'CREATE GLOBAL TEMPORARY TABLE AAA (NUM VARCHAR2(10),QTY INTEGER) ON COMMIT DELETE ROWS ';
execute immediate 'insert into AAA SELECT * FROM sss';
OPEN PO_RESULT FOR 'select * from AAA';
END BBBB;
------解决方案--------------------