plsql - How to change the cursors dynamically in oracle? -


i want change cursor in runtime dynamically.

procedure test_cur(a in varchar2,                    b in varchar2)  cursor cur_a select x.col_a,x.col_b tab_a x, tab_b y x.col_a = y.col_a  begin if (condition)  rec in cur_a loop    --do work  end loop; else  rec in cur_a loop 

in else section want add other code in clause of cursor. wanted know there other way this?

why not create 1 cursor , put part of clause condition:

cursor cur_a select x.col_a,x.col_b tab_a x, tab_b y x.col_a = y.col_a   , (condition , (rest of clause)); 

so 1 cursor , many 'conditions' need. know oracle optimize clause ignore parts condition if false (so no costs other compilation).

i used technique in complex search screens oracle. works well.

i hope helps.

christian


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -