CREATE PRIVATE TEMPORARY TABLE ORA$PTT_MyData_trans
(id number,
Name varchar2(30))
ON COMMIT DROP DEFINITION
Table created.
insert into ORA$PTT_MyData_trans values (1, 'john')
1 row(s) inserted.
REM Check data before commit.
Check data before commit.
select count(*) from ORA$PTT_MyData_trans
COUNT(*) | 1 |
---|
Commit
Statement processed.
REM Check data after commit.
Check data after commit.
select count(*) from ORA$PTT_MyData_trans
ORA-00942: table or view does not existMore Details: https://docs.oracle.com/error-help/db/ora-00942
REM Table is available until your transaction is not committed.
Table is available until your transaction is not committed.
select object_name from dba_objects where object_name like 'ORA$PTT_MyData_trans'
ORA-00942: table or view does not existMore Details: https://docs.oracle.com/error-help/db/ora-00942
REM Table is fully private and even does not exist in data dictionary.
Table is fully private and even does not exist in data dictionary.
REM We can overwrite this default behaviour with below command and can preserve the definition.
We can overwrite this default behaviour with below command and can preserve the definition.
CREATE PRIVATE TEMPORARY TABLE ORA$PTT_MyData_session
(id Number,
name varchar2(30))
ON COMMIT PRESERVE DEFINITION
Table created.
insert into ORA$PTT_MyData_session values(1,'mandy')
1 row(s) inserted.
insert into ORA$PTT_MyData_session values(1,'john')
1 row(s) inserted.
select * from ORA$PTT_MyData_session
ID | NAME | 1 | mandy | 1 | john |
---|
commit
Statement processed.
select * from ORA$PTT_MyData_session
ID | NAME | 1 | mandy | 1 | john |
---|
select object_name from dba_objects where object_name like 'ORA$PTT_MyData_session'
ORA-00942: table or view does not existMore Details: https://docs.oracle.com/error-help/db/ora-00942
REM You can’t gather statistics as these tables won’t exist in data dictionary.
You can’t gather statistics as these tables won’t exist in data dictionary.
exec dbms_stats.gather_table_stats('','ORA$PTT_MyData_session')
ORA-20000: Unable to analyze TABLE "SQL_KKSIZLTMGFVAJWYAQWESZLBPX"."ORA$PTT_MYDATA_SESSION", insufficient privileges or does not exist ORA-06512: at "SYS.DBMS_STATS", line 39094 ORA-06512: at "SYS.DBMS_STATS", line 38371 ORA-06512: at "SYS.DBMS_STATS", line 38530 ORA-06512: at "SYS.DBMS_STATS", line 39076 ORA-06512: at line 1 ORA-06512: at "SYS.DBMS_SQL", line 1721More Details: https://docs.oracle.com/error-help/db/ora-20000
REM Private temporary tables must be prefixed with “ORA$PTT_” and this can’t be used for regular table.
Private temporary tables must be prefixed with “ORA$PTT_” and this can’t be used for regular table.
CREATE PRIVATE TEMPORARY TABLE MyData_session
(id Number,
name varchar2(30))
ON COMMIT PRESERVE DEFINITION
ORA-00903: invalid table nameMore Details: https://docs.oracle.com/error-help/db/ora-00903
CREATE TABLE ORA$PTT_MyData_session
(id Number,
name varchar2(30))
ON COMMIT PRESERVE DEFINITION
ORA-00922: missing or invalid optionMore Details: https://docs.oracle.com/error-help/db/ora-00922