set long 10000 set heading off set trimspool on set lines 300 set longchunksize 300 spool all_mycons.sql exec dbms_metadata.set_Transform_param(dbms_metadata.session_transform,'SQLTERMINATOR',true); select dbms_metadata.get_ddl('CONSTRAINT','SYS_C006257121','SCOTT') FROM DUAL; -- For Foreign key constraints, use the REF_CONSTRAINT constant: select dbms_metadata.get_ddl('REF_CONSTRAINT','MYFOREIGNKEY_FK','SCOTT') FROM DUAL;
Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.
Monday, January 18, 2016
How to use dbms_metadata to generate DDL for constraints
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment