Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating an individual procedure in an Oracle package

Using Oracle 10g.

I'm writing a script to apply the delta changes made on our development system to our stage system.

Is there a way to modify or insert an individual procedure within a package without including the entire package contents in my script? I think the answer is no, but I wanted to be sure because it's going to be pretty ugly to have to include the entire contents of any modified packages when the changes were small.

like image 363
wadesworld Avatar asked Feb 04 '10 17:02

wadesworld


People also ask

Can you alter procedure in package?

Because all objects in a package are stored as a unit, the ALTER PACKAGE statement recompiles all package objects. You cannot use the ALTER PROCEDURE statement or ALTER FUNCTION statement to recompile individually a procedure or function that is part of a package.

Can we call procedure inside the package in Oracle?

procedures in the body are private and can only be called from other modules inside the package.


2 Answers

Sorry but your gut instinct is correct. The unit of change is the PACKAGE BODY.

Not sure why you think it's ugly though. surely it's just a matter of calling a script for the package?

like image 75
APC Avatar answered Oct 26 '22 14:10

APC


No, a package body must be replaced as a whole. Rather than include the code for several packages in a single script, I would create a file per package spec and a file per package body. You can then write a "meta-script" to run the required package changes in SQL Plus:

@@package1.spc
@@package1.bdy
@@package2.bdy
like image 22
Tony Andrews Avatar answered Oct 26 '22 14:10

Tony Andrews