Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Some "formula" interpreter or returning value from unnamed PL/Sql blocks

533544Jun 1 2009 — edited Jun 1 2009
Hello,

My company is developing Payroll and HR software and we use Oracle 10G Database. For a new module we are looking for a system were the end user (power user) can put in some kind of "formula's" to define what info/figures he wants for certain calculations done by de module (the budget module calculations will be done in PL/SQL stored proc written by us).

Example: item "MonthlySalaryCost" = (BaseYearSal + TotalBonus)/12
Where BaseYearSal and TotalBonus are functions that exist our will exist in or database. The idea is that a PL/SQL proc (which will be the same for all our customers), at runtime will execute that "formula" and use the result in its further calculations. The "formulas" will be stored in a table. (I foresee of course a "formula" validation to prevent dangerous sql-injection).

My idea was to use Execute Immediate in the proc to execute the formula's and work with the results. In this approach we have to write (and foresee) all possible functions to access the data the user wants to use.

Another (more powerful) solution I think about, is seeing these "formula's" as unnamed PL/SQL blocks (stored in a table), were the end user (or consultant) can use the full power of PL/SQL (if then else, select into ..., etc..) to obtain the result he wants to return into the item.
My problem here is : how to return a value from a unnamed PL/SQL block that is executed via Execute Immediate in a stored proc ?

And a general question: what do you think of this approach ? are there others possibilities to do this ?

Thanks in advance,

Philippe.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2009
Added on Jun 1 2009
4 comments
599 views