Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pro C versus PL/SQL
Lolita wrote:
<snip>
> 2- A package is dynamically created to translate all the rules (around
> 300 can go up to 999) into elsif statements.
Why not dynamically create the select statement instead? Just change those dynamic 'elsif' statements into a CASE statement to identify which rule each row matches and filter out the rows that didn't match ...
SELECT *
FROM (
SELECT ...
CASE
WHEN <dynamic condition> THEN 1 WHEN <dynamic condition> THEN 2 ... ELSE -1