What's the benefit of creating functions and procedures inside of a package instead of creating standalone functions and procedures? Any performance benefit?
Thank you.
Printable View
What's the benefit of creating functions and procedures inside of a package instead of creating standalone functions and procedures? Any performance benefit?
Thank you.
I am not sure about any performance gain by putting procedure/function together into package. It is entirely depend on your application requirement, database design and your application logic for example if you are developing CRM or ERP module and one procedure is calling other procedure or function or you have too many procedure is depend on each other than as a developer I would like to put some amount of set of procedure or function together into one meaningful package for particular task that makes developers life easier to maintain and debug the application code.
Yes, profit of performace and memory.
Possibility to use global variable.
Where I work we try to take common business functions/logic and encapsulate them into a packages. We have a package for logging error messages. We have another package that stores all of the reports.
The advantage is that each procedure/function in a package that uses common code with another procedure/function in the same package can call the same procedure/function. We also use global variable as constants. I.E. for things that aren't supposed to change, but might change. Which makes the code more readable and flexible. It also means we don't always have to pull the information from a table.
Code that is completely unrelated to any other code could be a stand alone procedure/function. However, I like the idea of compartmentalizing code into packages. I find it easier to maintain. But to each their own.
Read this, and then use packages
Damn, I was just looking for that... You beat me to the punch...Quote:
Thank you all!