0

I have lots of schemas and tables. I want to generate create script of all of my tables. I am using below statement and it is working pretty well.

SELECT DBMS_METADATA.GET_DDL('TABLE','table_name','schema') FROM DUAL

But because this statement also generates all primary and foreign key scripts that belong to table when I try to insert my tables to another location I am getting "ORA-00942: table or view does not exist" error because I didn't create key's reference tables yet.

You can say that, previousl

So, is there any way to not include primary and foreign keys in create table scripts

2

This will do the trick :

EXEC dbms_metadata.set_transform_param (dbms_metadata.session_transform,'STORAGE',false);
EXEC dbms_metadata.set_transform_param (dbms_metadata.session_transform,'TABLESPACE',false);
EXEC dbms_metadata.set_transform_param (dbms_metadata.session_transform,'SEGMENT_ATTRIBUTES', false);
EXEC dbms_metadata.set_transform_param (dbms_metadata.session_transform,'REF_CONSTRAINTS', false);
EXEC dbms_metadata.set_transform_param (dbms_metadata.session_transform,'CONSTRAINTS', false);

SELECT DBMS_METADATA.GET_DDL('TABLE','table_name','schema') FROM DUAL
|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.