This discussion is archived
2 Replies Latest reply: Nov 29, 2012 10:26 AM by rp0428 RSS

Generating CSV file using java/ stored proc

976981 Newbie
Currently Being Moderated
Hi Folks,

I am using Oracle 11g DB

My requirement is that I have to generate a CSV file which has customer details. Each value that is comma separated comes from different set of SQL queries. I want to write a stored procedure along with java code to acieve this. How do I go about it? Should I return multiple cursors from my stored proc and iterate from the java side to create the CSV file? Any other suggestions?

Thanks
Vishal
  • 1. Re: Generating CSV file using java/ stored proc
    Osama_Mustafa Oracle ACE
    Currently Being Moderated
    Better to post it here


    Oracle Discussion Forums » Java
  • 2. Re: Generating CSV file using java/ stored proc
    rp0428 Guru
    Currently Being Moderated
    >
    I am using Oracle 11g DB

    My requirement is that I have to generate a CSV file which has customer details. Each value that is comma separated comes from different set of SQL queries. I want to write a stored procedure along with java code to acieve this. How do I go about it? Should I return multiple cursors from my stored proc and iterate from the java side to create the CSV file? Any other suggestions?
    >
    Other suggestions? Yes - don't reinvent the wheel - it has already been created.

    1. Tom already wrote such a proc and published it many years ago. See this AskTom thread
    http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:235814350980

    2. See BluShadow's link from the '5. How do I read or write an Excel file?' question in the FAQ at the top of the sql and pl/sql forum
    SQL and PL/SQL FAQ

    3. Use a sql developer query like 'select /*csv*/ * from emp

    4. Search the sql and pl/sql forum for csv and use of the many threads that already answer this.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points