Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing part of an Oracle package

I need to modify one procedure from within a package. I need to touch both the declaration and the implementation. As I am maintaining patch files for each modification, I would like the changes to be minimal.

Can I update the package with just the changed procedure ( if yes, how ? ) , or do I need to supply the complete package definition and implementation?

like image 674
Robert Munteanu Avatar asked Sep 06 '10 14:09

Robert Munteanu


2 Answers

You need to replace the whole package specification and body - you cannot operate on just part of a package.

like image 167
Tony Andrews Avatar answered Sep 24 '22 16:09

Tony Andrews


Just to contradict everyone else . . .

Technically you could do it - you could write something that would take in your patch file, retrieve the existing package source from the database (using USER_SOURCE), apply your patch, and then recompile the package using EXECUTE IMMEDIATE.

However, I don't think it would be a very good idea - patch based fixing becomes very difficult to keep track of, especially once multiple patches and multiple databases are involved. Putting the whole file into source control is a lot better - your patch should still be clearly visible.

If the patch is to a third-party package, consider wrapping it - so that everything is a straight call through except your patch. Or put your patch into a standalone package that calls the first one. There is still a danger that a change to the original package could be incompatible with your patch.

like image 24
JulesLt Avatar answered Sep 24 '22 16:09

JulesLt