在Oracle中
CREATE GLOBAL TEMPORARY(
ON COMMIT PRESERVE ROWS
CREATE GLOBAL TEMPORARY(
ON COMMIT DELETE ROWS
CREATE GLOBAL TEMPORARY TABLE MyTempTable
所建的臨時表雖然是存在的
create or replace procedure pro_temp(v_col
v_num number;
begin
select count(*) into v_num from user_tables where table_name=
if v_num<
execute immediate
COL
COL
) ON COMMIT delete ROWS
end if;
execute immediate
execute immediate
dbms_output
execute immediate
commit;
execute immediate
end pro_temp;
測試:
PL/SQL 過程已成功完成
已用時間:
ERROR
ORA
通過查詢創建臨時表
create proecdure name_pro
as
str varchar
begin
str:=
from other_tables
execute immediate str;
end;
臨時表只在當前連接內有效
臨時表不建立索引
數據處理比較復雜的時候時表快
在僅僅查詢數據的時候建議用游標: open cursor for
From:http://tw.wingwit.com/Article/program/Oracle/201311/18537.html