Oracle Primary Keys Export.

select dbms_lob.substr(dbms_metadata.get_ddl('CONSTRAINT', t.constraint_name, 'SCOTT'),5000,1)
from
   user_constraints t
where
   t.constraint_type = 'P'
   and t.owner = 'SCOTT';

-- OR

select dbms_lob.substr(dbms_metadata.get_ddl('CONSTRAINT', t.constraint_name),5000,1)
from
   user_constraints t
where
   t.constraint_type = 'P';
    

Kopieren