Unpack column values

Database
BPP
Enthusiast

Unpack column values

Hello, any one has solution for this? is there unpack udf with anyone and willing to share?

Problem:-

Column values:  abcd, 1234, 3456, 34656,......, nnnn

Desired Output:

col1     col2        col3              col4               coln

abcd    1234      3456            34656            nnnn

Unpivoted results are also fine.. 

Like

col

abcd

1234

...

nnnn

Currently doing this with standard sql functions (comb of len, substr, case etc ) and it is very slow.. let me know, thanks in advance for your time.

1 REPLY
Enthusiast

Re: Unpack column values

Hi,

I Guess your requirement is to convert ROWS into COLUMNS. Is it right?

If so then below is the query:

sel col1 from pack.table

union

sel col2 from pack.table