While running the following SQL I am getting the error ..
Any idea why this is occurring .. and how to prevent it ..
1 SELECT DBMS_METADATA.get_ddl('CONSTRAINT'
2 ,constraint_name)
3* FROM all_constraints
SQL> /
ERROR:
ORA-31603: object "SYS_C00532" of type CONSTRAINT not found in schema
"EDW_2_3_0"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 628
ORA-06512: at "SYS.DBMS_METADATA", line 1221
ORA-06512: at line 1
The problem here seems to be with NOT NULL constraints that are system generated as CHECK constraints. Those constraints seems to be correctly incorporated in CRATE TABLE generated with DBMS_METADATA('TABLE', table_name), but fail with DBMS_METADATA('CONSTRAINT, constraint_name).
I thought those system-generated NOT NULL check constraints could be filtered out by using (this should be at least the closest approximation):
Code:
SELECT DBMS_METADATA.get_ddl('CONSTRAINT' ,constraint_name)
FROM USER_CONSTRAINTS
WHERE NOT (constraint_type = 'C' AND AND search_condition LIKE '%" NOT NULL';)
but unfortuantely the column SEARCH_CONDITION in USER_CONSTRAINTS is of type long.
So I guess the closest approximation you could get with those check constraints would be
Code:
SELECT DBMS_METADATA.get_ddl('CONSTRAINT' ,constraint_name)
FROM USER_CONSTRAINTS
WHERE NOT (constraint_type = 'C' AND GENERATED = 'GENERATED NAME');
This of course could filter out some o your "something-different-than-not-null-check-costraint" that you didn't bother to name explicitely.
Last edited by jmodic; 11-24-2004 at 04:21 PM.
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Bookmarks