在 Oracle PL/SQL 中,我有这段代码来学习全局临时表。我将临时表定义为
CREATE GLOBAL TEMPORARY TABLE "TEST"."WORKTABLE"
( "VAL" VARCHAR2(2000 BYTE) )
ON COMMIT PRESERVE ROWS ;
当我选择它时,它没有显示任何记录。
请帮忙。
declare
r_countries countries%rowtype;
v_country_id countries.country_id%type;
begin
----------- clean temp table ---------
execute immediate 'truncate table worktable';
select * into r_countries from countries r where r.country_id = 'AU';
select country_id into v_country_id from countries where country_id = 'AU';
insert into worktable
select country_id from countries where country_id = 'AU';
--dbms_output.put_line(r_countries.country_id);
--dump_table('worktable');
execute immediate 'select * from worktable'; -- no return
----------- clean temp table ---------
execute immediate 'truncate table worktable';
end;
/