Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Cursor output to CSV
Hi Helge, so far nobody has posted an implementation for your query so I thought I'd give it a go.
> 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.
With very little effort you will be able to wrap up what I've written below in a procedure passing a ref cursor etc. Note specifically that it meets your generic requirement - not one bit of the code references the columns ID, otherStuff1, otherStuff2, or otherStuff3 in table tblTest.
Good luck!
Mike
TESSELLA Michael.OS..._at_tessella.com
__/__/__/ Tessella Support Services plc __/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England __/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301www.tessella.com Registered in England No. 1466429
SQL> DESCRIBE tblTest
Name Null? Type ----------------------------------------- -------- ---------------- ID NUMBER OTHERSTUFF1 VARCHAR2(50) OTHERSTUFF2 DATE OTHERSTUFF3 NUMBER
SQL>
SQL> SELECT *
2 FROM tblTest;
ID OTHERSTUFF OTHERSTUF OTHERSTUFF3
------- ---------- --------- ----------- 1 One 11-JUN-06 1.1 2 Two 10-JUN-06 2.2 3 Three 09-JUN-06 3.3 SQL>
7 SELECT * 8 FROM tblTest 9 WHERE id=1;
18 <xsl:value-of select="."/> 19 <xsl:if test="position()!=last()">,</xsl:if> 20 </xsl:for-each>
PL/SQL procedure successfully completed.
SQL> SQL> SQL> SQL> SELECT *
SQL>
SQL>
Received on Mon Jun 12 2006 - 12:16:47 CDT
![]() |
![]() |