テンポラリテーブル

 

--トランザクション終了時にデータ削除。テーブルは永続的
create global temporary table ttab1(col1 int) on commit delete rows;


--セッション終了時にデータ削除。テーブルは永続的
create global temporary table ttab2(col1 int) on commit preserve rows;

 

※18c以降はprivate temporary tableを使用可能
https://qiita.com/plusultra/items/dc85104ff5b9b90cb21b

show parameter private_temp_table_prefix;


--トランザクション終了時にテーブル削除
create private temporary table ora$ptt_ttab1(col1 int) on commit drop definition;

--セッション終了時にテーブル削除
create private temporary table ora$ptt_ttab2(col1 int) on commit preserve definition;

 

 

--セッション終了時にテーブル削除
create temporary table ttab1(col1 int);

--トランザクション終了時にテーブル削除
create temporary table ttab1(col1 int) on commit drop;


--セッション終了時にテーブル削除
create temporary table ttab2(col1 int) on commit preserve rows;

--トランザクション終了時にデータ削除。セッション終了時にテーブル削除。
create temporary table ttab3(col1 int) on commit delete rows;

 

https://memo.itsysgroup.com/?p=1103

--ローカル一時テーブル
--作成したユーザーの現在のセッション接続でのみ表示され、このユーザーが SQL Serverインスタンスから切断すると削除
create table #ttab1(col1 int);


--グローバル一時テーブル
--すべてのユーザーに表示され、全ての参照がなくなったタイミングで自動的に削除
create table ##ttab2(col1 int);