Cursor -- passing where clause string as parameter?
606275Aug 13 2009 — edited Aug 13 2009I do not believe this is possible, but just want to make sure.
I have several cursors that select the same columns from the same table, only the WHERE clause changes. I was looking into consolidating the cursors into perhaps one cursor, since the cursor itself is quite large in the code (due to sorting cases, etc.). I was wondering if one could do the following:
Have a cursor defined as cursor_name (param1)...
Then, when opening the cursor, passing a string to the cursor so as to switch the WHERE clause each time.
I.e.:
Cursor cursor_name (param1) IS SELECT ... FROM ... WHERE param1;
When I attempt to do this in my PL/SQL code, I obviously receive an error. Which leads me to believe that such a thing isn't possible? Any other suggestions then of how I can consolidate my similar cursors?
Thanks in advance.