creating a ad-hoc report system where the number of columns is variable. We'll know the number of columns at runtime but would like to make this process as generic as possible. Instead of hard-coding the collection groups, We'd like to use something like the following code:
for i in 1..g_count -1 loop
l_field := l_field ||'l_value' || i || ', ';
end loop;
l_field := l_field || 'l_value'||g_count;
-- would like to use this
fetch l_ref_cur bulk collect into l_field;
-- instead of this
fetch l_ref_cur bulk collect into l_value, l_value1, l_value2, l_value3, l_value4, l_value5, l_value6;
This error is generated when compiling the code for the first fetch statement:
PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list.
How can I tell the compiler to use the value of l_field instead of the variable name?