patternMinor
How in Oracle can I export package that will have package and body?
Viewed 0 times
canpackagewillthatexporthowandbodyoraclehave
Problem
I'm using putty. How in Oracle can I export package and its body to a file in present directory using spool?
Thanks
Thanks
Solution
There are two ways to achieve this
Way 1 :
Way 2:
Another way suggested by @vercelli that is exporting the package and it's body using Oracle
Hope this helps !!
Regards.
Way 1 :
SET HEAD OFF
SET ECHO OFF
SET FEED OFF
SET TERM OFF
SET LINE 1500
SET NEWPAGE NONE
set pagesize 0
SPOOL C:\temp\FILE_NAME.SQL
PROMPT CREATE OR REPLACE
select trim(text) from user_source
where name='PACKAGE_NAME' AND type='PACKAGE';
SPOOL OFFWay 2:
select dbms_metadata.get_ddl('PACKAGE','PACKAGE_NAME',USER) from dual;Another way suggested by @vercelli that is exporting the package and it's body using Oracle
expdp utility. A wonderfull method :) expdp scott/tiger@db10g schemas=SCOTT INCLUDE=PACKAGE LIKE 'PACKAGE_NAME' SQLFILE=scott.sql directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.logHope this helps !!
Regards.
Code Snippets
SET HEAD OFF
SET ECHO OFF
SET FEED OFF
SET TERM OFF
SET LINE 1500
SET NEWPAGE NONE
set pagesize 0
SPOOL C:\temp\FILE_NAME.SQL
PROMPT CREATE OR REPLACE
select trim(text) from user_source
where name='PACKAGE_NAME' AND type='PACKAGE';
SPOOL OFFselect dbms_metadata.get_ddl('PACKAGE','PACKAGE_NAME',USER) from dual;expdp scott/tiger@db10g schemas=SCOTT INCLUDE=PACKAGE LIKE 'PACKAGE_NAME' SQLFILE=scott.sql directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.logContext
StackExchange Database Administrators Q#147831, answer score: 4
Revisions (0)
No revisions yet.