00600 when moving tablespace in oracle trigger
I need to change the tablespace when client create table with specified tablespace, so I write the following trigger:
CREATE OR REPLACE TRIGGER TRIG_MON_DDL
AFTER CREATE OR ALTER ON DATABASE
DECLARE
SQL_TABLESPACE_NAME VARCHAR2(60);
INDEX_TABSP_NAME VARCHAR2(60);
CUR_USER VARCHAR2(100);
SQL_TEXT VARCHAR2(2000);
V_SQL VARCHAR2(2000);
BEGIN
SELECT NVL(SYS_CONTEXT('USERENV','CURRENT_SCHEMA'),'') INTO CUR_USER FROM DUAL;
IF SYSEVENT = 'CREATE' OR SYSEVENT = 'ALTER' THEN
IF ORA_DICT_OBJ_TYPE ='TABLE' THEN
SELECT TABLESPACE_NAME INTO SQL_TABLESPACE_NAME FROM USER_TABLES WHERE TABLE_NAME=ORA_DICT_OBJ_NAME;
IF INSTR(SQL_TABLESPACE_NAME,'_'||CUR_USER)=0 THEN
V_SQL:='ALTER TABLE ' || 'FOO.' || ORA_DICT_OBJ_NAME||' MOVE TABLESPACE '||SQL_TABLESPACE_NAME||'_'||CUR_USER||'';
EXECUTE IMMEDIATE V_SQL;
END IF;
END IF;
END IF;
END;
/
And run the create statement
CREATE TABLE FOO.ADMIN_EMP1 (id NUMBER(5), name VARCHAR2(15) NOT NULL) TABLESPACE TB;
CUR_USER is FOO. So the trigger will move the table from tablespace TB to TB_FOO, but when the trigger run the EXECUTE IMMEDIATE V_SQL, it came out to be the following.
ERROR at line 1:
ORA-00600: internal error code, arguments: [17058], [0x06406F530], [], [], [],
[], [], [], [], [], [], []
I can't figure out why. And I am finding if there are other solutions to solve my case.
链接地址: http://www.djcxy.com/p/36934.html上一篇: Oracle强制转换(时间戳记为日期)