The script below will do a good job of getting the constraints, except for foreign key constraints (type 'R'). Spool the output from dba_constraints to get the name and owner. PS - This script also doesn't do triggers well. -- get_object.sql -- Three inputs -- &&1- the type of object (PACKAGE, PROCEDURE, TRIGGER, etc. -- &&2 - the name of the object -- &&3 - the schema that owns the object set pages 0 set lines 132 set long 10000 select dbms_metadata.get_ddl(upper('&&1') ,upper('&&2'),upper('&&3')) FROM DUAL; UNDEFINE 1 undefine 2 undefine 3 -- //www.freelists.org/webpage/oracle-l