Re: How to transpose?

From: Peter Y. Hsing <hsing_at_ix.netcom.com>
Date: 1996/05/20
Message-ID: <4noo1v$mfc_at_sjx-ixn4.ix.netcom.com>#1/1


Mason:

This is interesting. Do you mind if I ask why you need to transpose? How is the transposed data going to be used, ie, do you really need to transpose the data?

Have you tried using an array and then stepping through it row by row, then column by column, i.e. starting from the first record, read the data into a *column* of an array or temporary table via double loop (fill in array columns from the table, row by row). Maybe this can probably be done via PL/SQL; otherwise, it can be easily handled by SQR (a populur product by MITI/Sybase).

-Peter Hsing

On Fri, 17 May 1996 12:37:44 -0700, Mason Liu <lium_at_dspmp001.research.allied.com> wrote:

>Say I retrieve 8 rows x 95 columns of data. What is the most efficient
>way to transpose it so that it becomes 95 rows x 8 columns.
>
>I can accept a single data block with tab separated data items and
>carriage return+new line separated rows.
>
>Right now, I built a big concatenation SQL to accomplish this and I
>wonder, perhaps, there is a better way. For example, Oracle might have a
>a undocumented TRANSPOSE function for me to use, althought Oracle support
>said none.
>
>Thanks in advance.
>
>Mason Liu
>Object Labs, Inc.
Received on Mon May 20 1996 - 00:00:00 CEST

Original text of this message