Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Query: Switching Rows to Columns dynamically.

Re: SQL Query: Switching Rows to Columns dynamically.

From: ian <ipellew_at_yahoo.com>
Date: 17 Oct 2006 05:45:09 -0700
Message-ID: <1161089109.153902.186550@i42g2000cwa.googlegroups.com>


Hi;

I know this is NOT strictly an SQL answer, but I have just done this using Perl.

I do cheat in the SQL by ||'!'|| each of the columns into one wide "set lines 5000" row per row set.
Then a simple perl script to "pivot" all this into a nice tall Excel sheet for my user(s).

Perl is basically :-
While (<>){

    read each line into an array
}

{

   Foreach column

       foreach row
             print cell

}

I currently pivot over 300 columns into no more than 25 rows using "where ... and rownum < 25"
Made my life much easier, and my butt shines!! I even union'ed an header row so users can see each named Excel row.

Sorry if this is no help. Just my bit to the list.

Regards
Ian Received on Tue Oct 17 2006 - 07:45:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US