说明
私有临时表是18c中新引入的特性,但是在实验时无法正常创建私有临时表,报错
SQL> CREATE PRIVATE TEMPORARY TABLE ora$ptt_my_temp_table (
id NUMBER,
description VARCHAR2(20)
)
ON COMMIT DROP DEFINITION;
CREATE PRIVATE TEMPORARY TABLE ora$ptt_my_temp_table (
*
ERROR at line 1:
原因
经过不断测试终于找到了原因,就是不要使用sys用户来创建.
1.使用非sys用户
SQL> show pdbs
SP2-0382: The SHOW PDBS command is not available
SQL> show con_name
CON_NAME
------------------------------
LEIPDB
SQL> create private temporary table ora$ptt_a
(
n number
) on commit preserve definition;
Table created.
2.使用system用户
SQL> conn system/oracle
Connected.
SQL> CREATE PRIVATE TEMPORARY TABLE ORA$PTT_sales_ptt_transaction
(time_id DATE,
amount_sold NUMBER(10,2))
ON COMMIT DROP DEFINITION;
Table created.
3.使用SYS用户
SQL> conn sys/oracle as sysdba
Connected.
SQL> CREATE PRIVATE TEMPORARY TABLE ORA\$PTT_sales_ptt_transaction
(time_id DATE,
amount_sold NUMBER(10,2))
ON COMMIT DROP DEFINITION;
CREATE PRIVATE TEMPORARY TABLE ORA$PTT_sales_ptt_transaction
*
ERROR at line 1:
ORA-14451: unsupported feature with temporary table
4.使用具有sysdba权限的用户
SQL> grant sysdba to lei;
Grant succeeded.
SQL> conn lei/oracle@leipdb
Connected.
SQL> CREATE PRIVATE TEMPORARY TABLE ORA$PTT_test
(time_id DATE,
amount_sold NUMBER(10,2))
ON COMMIT DROP DEFINITION;
Table created.
|