Get the App
SLTechnology News&Howtos  ›  Database  › 

Introduction to two modes of oracle global temporary table

Shulou Source: shulou.com Published: 2022-05-31 18:20:19 11月12日 Update

This article introduces the knowledge of "introduction of two modes of oracle Global temporary Table". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

There are two modes of the global temporary table, one is based on the session level, the data between the session and the session is isolated, when the session segment is dropped, the data will be emptied, and the other is based on the transaction level, the global temporary table uses the location of the temporary table space when executing commit or rollback data.

Global temporary tables are not logged, but they are not secure for data.

-construct a global temporary table based on SESSION (if you exit session, the table record will be emptied automatically)

Drop table ljb_tmp_session

Create global temporary table ljb_tmp_session on commit preserve rows as select * from dba_objects where 1: 2;-- temporary table based on session

Select table_name,temporary,duration from user_tables where table_name='LJB_TMP_SESSION'

-- construct a global temporary table based on transactions (after commit commits, the records in the table will be emptied automatically if session is exited)

Drop table ljb_tmp_transaction

Create global temporary table ljb_tmp_transaction on commit delete rows as select * from dba_objects where 1item2;-transaction-based temporary tables

Select table_name, temporary, DURATION from user_tables where table_name='LJB_TMP_TRANSACTION'

Insert all

Into ljb_tmp_transaction

Into ljb_tmp_session

Select * from dba_objects

Select session_cnt,transaction_cnt from (select count (*) session_cnt from ljb_tmp_session)

(select count (*) transaction_cnt from ljb_tmp_transaction)

Commit

Select session_cnt,transaction_cnt from (select count (*) session_cnt from ljb_tmp_session)

(select count (*) transaction_cnt from ljb_tmp_transaction)

Disconnect

Connect ljb/ljb

Select session_cnt,transaction_cnt from (select count (*) session_cnt from ljb_tmp_session)

(select count (*) transaction_cnt from ljb_tmp_transaction)

This is the end of the introduction to the two modes of the oracle global temporary table. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Overall situation data pattern transaction content more knowledge level practicality security achievement next between location dilemma reality situation article log case Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Huawei Microsoft OPPO Reno Linux