Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
What is the best way to migrate Oracle Package to PostgreSQL

What I have tried:

Thinking of creating procedures with package name as prefix.
Posted
Updated 13-Sep-21 6:55am

As it says here: The Complete Oracle to PostgreSQL Migration Guide: Move and convert Schema, Application & Data[^]
Quote:
PostgreSQL does not have packages but using schema architecture, functions and procedures can be grouped. Use the “orafce” migration tool library, which supports some of the standard packages, or EDB Postgres Advanced Server, which has built-in Packages.
 
Share this answer
 
Comments
tijojoseph1989 13-Sep-21 14:59pm    
We will not be able to use orafce because of some restrictions.
PostgreSQL does not have a similar object type as a package in Oracle so you need to break the package into separate procedures and functions. What comes to the naming, I don't see any specific reason to retain the name of the package as a prefix unless you have procedures (or functions) having the same name in different packages.

Few things you need to be careful with

  • Privileges, in Oracle, the privileges are granted to packages so when you break the package to separate procedures you need to apply same (or similar) privileges.
  • Common definitions, a package header may contain definitions that are common to all procedures inside the package. You may need to define a common procedure/function/type or another alternative is to repeat the definition in all procedures where needed.
  • Non-visible procedures etc, a package may have procedures or functions that are not visible from outside the package. Again you probably need to separate these to individual procedures, just make sure they can only be called from proper places and by proper users
 
Share this answer
 
Comments
tijojoseph1989 13-Sep-21 14:58pm    
This packages will be referred from Shell Script or Java Code like package.procedure1. Thinking of changing it to package_procedure1. Is that a good approach.
Wendelius 13-Sep-21 15:53pm    
I don't think it's either bad or good. If this naming conventions suits the requirements you have, it's probably a good way to go. Just keep in mind that the maximum length for the name is 63 bytes by default.
tijojoseph1989 14-Sep-21 1:42am    
ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900