Return-Path: <oracle-l-bounce@freelists.org>
Delivered-To: 2-oracle-l@orafaq.com
Received: (qmail 18704 invoked from network); 13 Jul 2007 17:35:17 -0500
Received: from freelists-180.iquest.net (HELO turing.freelists.org) (206.53.239.180)
  by 69.64.49.119 with SMTP; 13 Jul 2007 17:35:17 -0500
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0683A712719;
 Fri, 13 Jul 2007 18:33:09 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 25569-04-6; Fri, 13 Jul 2007 18:33:08 -0400 (EDT)
Received: from turing (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 73287711E42;
 Fri, 13 Jul 2007 18:33:08 -0400 (EDT)
Received: with ECARTIS (v1.0.0; list oracle-l); Fri, 13 Jul 2007 17:51:59 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id E96BE712E71
 for <oracle-l@freelists.org>; Fri, 13 Jul 2007 17:51:58 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 13225-01 for <oracle-l@freelists.org>;
 Fri, 13 Jul 2007 17:51:58 -0400 (EDT)
Received: from optimaldba.com (optimaldba.com [204.3.137.185])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id AE8C5712E6C
 for <oracle-l@freelists.org>; Fri, 13 Jul 2007 17:51:57 -0400 (EDT)
Received: (qmail 60951 invoked by uid 2489); 13 Jul 2007 21:54:05 -0000
Received: from unknown (HELO [192.168.0.100]) ([67.176.125.191])
          (envelope-sender <daniel.fink@optimaldba.com>)
          by 204.3.137.185 (qmail-ldap-1.03) with SMTP
          for <nileshkum@gmail.com>; 13 Jul 2007 21:54:05 -0000
Message-ID: <4697F477.3060704@optimaldba.com>
Date: Fri, 13 Jul 2007 15:53:59 -0600
From: "Daniel W. Fink" <daniel.fink@optimaldba.com>
User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
MIME-Version: 1.0
To:  nileshkum@gmail.com
CC:  oracle-l@freelists.org
Subject: Re: How to export a package and a procedure
References: <7877ab4b0707131426i59f1897bo41011d82c7e37f11@mail.gmail.com>
In-Reply-To: <7877ab4b0707131426i59f1897bo41011d82c7e37f11@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-archive-position: 50878
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: daniel.fink@optimaldba.com
Precedence: normal
Reply-to: daniel.fink@optimaldba.com
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-subscribe: <oracle-l-request@freelists.org?Subject=subscribe>
List-owner: <mailto:steve.adams@ixora.com.au>
List-post: <mailto:oracle-l@freelists.org>
List-archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l
X-Virus-Scanned: Debian amavisd-new at localhost.localdomain

Nilesh,

You can use DBMS_METADATA to extract the code for stored 
procedures/packages/functions. It is available in 9i and 10g, though 
expect bugs. Nothing that crashes a database, but it might not output 
the code exactly the way you want it. Test and make slight changes if 
you need. The code below is a subset of a script I use to extract all 
the ddl from a schema. Use with care and change what you need.

SET LINESIZE 132 PAGESIZE 0 FEEDBACK off VERIFY off TRIMSPOOL on LONG 
1000000
COLUMN ddl_string FORMAT A100 WORD_WRAP

EXECUTE 
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY',true);
EXECUTE 
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
COLUMN ddl_string FORMAT A4000

PROMPT
PROMPT -- Schema Functions
PROMPT

SELECT DBMS_METADATA.GET_DDL('FUNCTION', o.name,'&&schema_owner') ddl_string
FROM sys.obj$ o
WHERE o.owner# = &&schema_id
  AND o.type# = 8
/

PROMPT
PROMPT -- Schema Packages (specs and body)
PROMPT

SELECT DBMS_METADATA.GET_DDL('PACKAGE', o.name,'&&schema_owner') ddl_string
FROM sys.obj$ o
WHERE o.owner# = &&schema_id
  AND o.type# = 9
/

PROMPT
PROMPT -- Schema Procedures
PROMPT

SELECT DBMS_METADATA.GET_DDL('PROCEDURE', o.name,'&&schema_owner') 
ddl_string
FROM sys.obj$ o
WHERE o.owner# = &&schema_id
  AND o.type# = 7
/


Daniel Fink


-- 
Daniel Fink

Oracle Performance, Diagnosis and Training

OptimalDBA    http://www.optimaldba.com
Oracle Blog   http://optimaldba.blogspot.com


nilesh kumar wrote:
> Hello All,
>
> I have an issue i need to export a package and a procedure too which 
> is present in another package , is there any solution for this in 
> datapump or exp utility.Or is there any other solution for this to do 
> pls help , i am using 9i and 10g both .
>
> Thanks
> Nilesh soni

--
http://www.freelists.org/webpage/oracle-l


