in reply to extract string columns with perl

Would it not be simpler to configure Oracle and/or the SQL query or PL/SQL extraction script to get the data in the proper format in the first place?

I don't usually get such a mess from Oracle databases, so there must be something wrong in your configuration (although I don't know what).

Replies are listed 'Best First'.
Re^2: extract string columns with perl
by juanito23 (Novice) on Apr 16, 2014 at 08:10 UTC
    Hi, I tried to format already the sql, but I am a bit limited, since I need to get the columns in a certain order like: select column2, column4, column1, etc... from table; and then spool this into a csv file

    configurations in sql session before spooling are as this: set feedback off

    set heading on

    set FEEDBACK off

    set verify off

    set numwidt 20

    set echo off

    SET TERMOUT OFF

    set linesize 10000

    set pagesize 0

    Not sure if I can do anything else to help with the format? Thanks!
      Well, I am using something similar (although not sure for every detail). One additional statement you could use to get a CSV is:
      set colsep ,
      Also, you may want to use the trim function in your select statement.
        Nice one thanks for the hint. I checked the oracle linesize limit and set it to 32767 which is the max.

        Looks to help with the csv file format and now I sorted it.

        Thanks to all!