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):
but unfortuantely the column SEARCH_CONDITION in USER_CONSTRAINTS is of type long.Code:SELECT DBMS_METADATA.get_ddl('CONSTRAINT' ,constraint_name) FROM USER_CONSTRAINTS WHERE NOT (constraint_type = 'C' AND AND search_condition LIKE '%" NOT NULL';)
So I guess the closest approximation you could get with those check constraints would be
This of course could filter out some o your "something-different-than-not-null-check-costraint" that you didn't bother to name explicitely.Code:SELECT DBMS_METADATA.get_ddl('CONSTRAINT' ,constraint_name) FROM USER_CONSTRAINTS WHERE NOT (constraint_type = 'C' AND GENERATED = 'GENERATED NAME');




Reply With Quote