Hi all,
I have this problem: In a loop I have to create dynamically an insert statement with a number of bind variables that is not always the same.
TYPE t_ARRAY IS TABLE OF VARCHAR2(100) INDEX BY NUMBER;
a_VALUES_ARRAY t_ARRAY;
<LOOP #1>
<SUB_LOOP fetching s_COL names and v_VALUES values >
s_COL_INS := s_COL_INS || ' ,' || s_COL; /* for ex. A,B,C */
s_PLACEH := s_PLACEH || ' ,:VAL' || n_COUNTER; /* for ex. :VAL1,:VAL2,:VAL3*/
a_VALUES_ARRAY[ n_COUNTER ] := v_VALUES ;
n_COUNTER := n_COUNTER +1;
<END SUB_LOOP>
s_SQL_STMT := 'INSERT INTO TAB_A (' || s_COL_INS || ') VALUES (' || s_PLACEH || ')';
EXECUTE IMMEDIATE
s_SQL_STMT USING <a_VALUES_ARRAY>; /* (???) Here is the problem */
<LOOP #2>
I can got s_COL_INS = B,C,E,F
<LOOP #3>
I can got s_COL_INS = A,F
and so on...
How can use the varray' values in the using statement???
Thanks in advance!
Filippo