In this post I’ll show you how to get Oracle SQL query results to CSV format into a CLOB only by calling stored procedures. This CLOB can be stored later in a table row or in a file using UTL_FILE.
There are two stored procedures:
- The first one, cursor_to_csv, takes a cursor as parameter
- The second one, query_to_csv, takes a VARCHAR2