-1

I want to import functions/procedures from another database only those that are not exist in my current database. I got object name using this:-

select OBJECT_NAME from dba_objects where owner = 'AKHSYS'  and  object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' ) minus select OBJECT_NAME from dba_objects  where owner = 'LDHSYS'  and object_type in ( 'PROCEDURE', 'PACKAGE', 'FUNCTION', 'PACKAGE BODY' );

but how can I create ddl script of all functions that are missing in my current schema?

0

1 Answer 1

1

Use DBMS_METADATA. Example:

SELECT owner, object_type, object_name, DBMS_METADATA.get_ddl (object_type, object_name, owner)
  FROM (SELECT owner, OBJECT_NAME, object_type
          FROM dba_objects
         WHERE owner = USER AND object_type IN ('PROCEDURE', 'PACKAGE', 'FUNCTION'))
ORDER BY 1,2,3         

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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