Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Cursor output to CSV
Helge wrote:
> This has been asked before, but the answer just pointed at Ask Tom.
> There are solutions similar to my question there, but nothing that
> quite fits.
>
> The problem is: How do you output a cursor to csv? It's easy if you
> know the structure of the cursor ahead of time, but that presents
> maintenance problems. What's needed is a generic method.
>
> Tom describes using dbms_sql, but as far as I can tell there's no way
> of associating a dbms_sql cursor handle (an integer that's normally set
> up by calling dbms_sql.open_cursor) with an open ref cursor. If there
> is a way, I'd love for someone to point it out to me.
Well if you use SQLPlus as the front end you could declare a cursor variable. Then you can dump the cursor contents with an SQLPlus print command: print cursor_variable
You would have to pass the cursor variable to a pl/sql procedure which either contained your cursor or called a routine that did. The procedure(s) would need to include a reference_cursor variable in the parameter list.
HTH -- Mark D Powell -- Received on Fri Jun 09 2006 - 19:18:35 CDT