Re: How to transpose columns and rows in 9i SQL*Plus

  • From: "Tom Pall" <oracle.list@xxxxxxxxx>
  • To: "Barbara Baker" <barb.baker@xxxxxxxxx>
  • Date: Fri, 10 Nov 2006 18:53:17 -0600

Barbara and Peter,

I thank you both.

In the beginning, Larry created Metalink and saw that it was good.  Then
some dudes got together and created Google, which works wonders if you use
the right incantations.  After getting nothing with (sqlplus rows columns
swap) the word "transpose" came to me.  Yup.  found the AskTom thread on
pivots.  I hardcoded 3 decodes and there it was.  I've handed the output to
the customer to review.  Yes, there are lots of empty rows because so far
there's 10 days of data and I coded for 3.  If the customer approves of the
format, now comes the fun part:  selecting distinct date where date between
10/31/06 and trunc(sysdate-1.'DD') in my SQL which creates then runs SQL.
Gosh they'll be long rows.  Better throw in some Wrap Music with the SQL.
when I hand it to my boss, the wannabe DBA. <G>

I haven't looked at Oracle-L for years even though I've been collecting it
for in Gmail since Gmail first became it beta.  It seemed to start off as
every question answered to random questions getting a deluged and other
questions getting no response at all.  I don't know which it is now but my
question got answered right about the time I discovered AskTom's solution.

Happy and Grateful to be part of the Oracle DBA community,
Tom

Other related posts: