views:

160

answers:

2

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.

+2  A: 

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?

APC
+1  A: 

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
Tony Andrews
you could break this concept down even further and have a file per procedure in the package header and body. This way your "meta-script" can pull together the pieces it needs at build time but it makes change tracking easier in your source control system, especially for large procedures.
ninesided
Do you mean breakdown the script of a package body into multiple files with each package body procedure in a separate file? Eek. Think I'd avoid that. Change tracking is easier in a single file with diffs.
Nick Pierpoint
No, no, no, I didn't mean that! Each file contains one **complete** package spec or body.
Tony Andrews