Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Move package from schema to another

Posted on 2007-07-29
2
Medium Priority
?
2,266 Views
Last Modified: 2013-12-18
How can i move a package that i created in user A to another user B in oracle 10.2
i have created my own test packages in the main user so i want to move it on another working schema.

what is the syntax to do so.

thanks
0
Comment
Question by:samir25
2 Comments
 
LVL 3

Accepted Solution

by:
prasanthi_k earned 1000 total points
ID: 19590657
I think there is no direct syntax for moving a packages from one schema to another.
The work around would be to seperately create the package in the other schema, first create package specification and then package body.

CREATE OR REPLACE PACKAGE package_name
     script of package
/
CREATE OR REPLACE PACKAGE BODY package_name
   script of package body
/
The script can be copied from the schema where the package exists now.

Or you can directly access the packages from the new schema by prefixing  the package name with schema name.
SchemaName.PackageName
0
 
LVL 4

Assisted Solution

by:WolfgangKoenig
WolfgangKoenig earned 1000 total points
ID: 19591216
in the old schema:
read your old package code with:
--<== script of package ==>
SELECT *
    FROM SYS.user_source
WHERE NAME = 'YOURPACKAGENAME' AND TYPE = 'PACKAGE';
ORDER BY line

--<== script of package body ==>
SELECT *
    FROM SYS.user_source
WHERE NAME = 'YOURPACKAGENAME' AND TYPE = 'PACKAGE BODY';
ORDER BY line

save it to a file or clipboard
drop package  'YOURPACKAGENAME' ;

recreate in the new schema:
CREATE OR REPLACE PACKAGE package_name
     script of package
/

CREATE OR REPLACE PACKAGE BODY package_name
   script of package body
/
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question