You have two options:
1) Always return the same number of columns. This can be done in two ways:
a) Set a maximum limit to the the number of columns and always return them, even if columns are filled with NULL.
b) Concatenate the variable number of columns into a single CSV column, giving you a fixed number of 4 columns (3 + CSV). You app can then process the CSV into its constituent parts.
2) Write some code to cope with a variable number of columns returned by a cursor. The DBMS_SQL package allows you to interrogate a cursor to find out how many columns it contains and the types of each of the columns. This way you can programatically process a variant result set. I use this type of processing for my code that produces CSV from any query.http://www.oracle-base.com/dba/Script.p ... le=csv.sql