Question : Moving_PLSQL_Code

What is the most common way of moving code (procedure, package) from one oracle instance to another.

I use a sql script in sql*plus (getcode my_pkg) that create a text file (script) on my client and then compile the script in the other instance (SQL> @my_pkg). Script was published in one of Tom Kyte books. However, i am finding the script creates many blank lines and changing the format of the code. When i look at the code copied it is not the clean readable format I used.

The tools i use are SQL*plus, SQL navigator and TOAD.

Answer : Moving_PLSQL_Code

you can use dbms_metadata.get_ddl to generate a script for you


select dbms_metadata.get_ddl('PACKAGE','YOUR_PACKAGE','YOUR_SCHEMA') from dual

or if you are using TOAD,  go to the schema browser,  right click on the package, click "Create in another Schema"

of course, the "best" method is to use the same script you used to create the object in your first environment to create it in your second environment
keep your scripts in a source code control system like CVS.
Random Solutions  
 
programming4us programming4us