I've been stuck with this problem, so I'm looking for help now.
I'm trying to get a .cvs file from a query with PL/SQL. I'm using a cursor and UTL_FILE to achieve that. The problem is that I have to pass all the column names to UTL_FILE.PUT_LINE(), and there are some columns that are set dynamically, so I don't know how to pass those columns to UTL_FILE.
I tried to build a string with those columns, but it doesn't work. Example:
FOR pointer IN (SELECT column1, column2, **piece_of_query_with_dynamic_columns**, column3 FROM table1)
LOOP
UTL_FILE.PUT_LINE(v_file, pointer.column1|| ',' ||pointer.column2|| ',' ||**string_with_dynamic_columns**|| ',' ||pointer.column3);
END LOOP;
UTL_FILE.FCLOSE(v_file);
The query works well and, except for those dynamic columns, I can get the .cvs file.
Any suggestions?
I hope i explained myself well