Avatar of ram_0218
Flag for United States of America

asked on 

dynamic bind variables

hi Gurus..

execute immediate 'select something from sometable where param1=:a and param2=:b' using a,b;

sounds good, if i have to dynamically add using clause how to do this?

for example i've a procedure

proc (a in varchar2, b in varchar2)
   vquery = 'select * from sometable where ';
  if (a is not null) then vquery = vquery || ' param1=:a';
  if (b is not null) then vquery = vquery || ' param2=:b';

 execute immediate vquery using ????

Oracle DatabaseSQL

Avatar of undefined
Last Comment
Sean Stuber

8/22/2022 - Mon