here is aproblem that i want to solve using simple oracle sql (no PLs)

there is a table with say one key (not primary), there are n rows with k rows for each key, now the maximum value of k is known. And the overall k values distributed for each key are also same ill give an example at this stage...

Col1 Col2

A 1

A 2

B 1

B 2

B 3

C 3

assuming k=3

now A can have either 1,2 or 3, but no more than 3 values that too comprising of 1 or 2 or 3 (lets say repetitions are also not allowed)

now i wnt a new table having my key as primary key and the k values in form of column for that primary key.example .(again for the above case)

Col1(Pk) Col2 Col3 Col4

A 1 2 -

B 1 2 3

C - - 3

I have been able to do this using PL/SQl or using some prog. language.

(I am actually creating some views and then using them in java)

but if the problem can be solved in simple SQL ...it would realy help plus i am definately gona learn something new.