I need to use dynamic SQL execution on Oracle where I do not know the exact number of bind variables used in the SQL before runtime.
Is there a way to use a variable number of bind variables in the call to EXECUTE IMMEDIATE
somehow?
More specifically, I need to pass one parameter into the unknown SQL but I do not know how often it will be used there.
I tried something like
EXECUTE IMMEDIATE 'SELECT SYSDATE FROM DUAL WHERE :var = :var' USING 1;
But it threw back with ORA-01008: not all variables bound.