2 Replies Latest reply: Nov 29, 2012 12:26 PM by rp0428 RSS

    Generating CSV file using java/ stored proc

    976981
      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
          Better to post it here


          Oracle Discussion Forums » Java
          • 2. Re: Generating CSV file using java/ stored proc
            rp0428
            >
            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.