Yes, but in 10g it is not as easy as it would be in 11g where the PIVOT clause was introduced.
You could do it using the DECODE function, but you would need to know all the possible codes to construct the query.
Something like this:
<pre>SELECT MAX(DECODE(code,'AAA',amount,NULL)) AAA,
MAX(DECODE(code,'BBB',amount,NULL)) BBB,
MAX(DECODE(code,'CCC',amount,NULL)) CCC
FROM codes;</pre>
Since the number of codes may vary, you would probably need to construct this query dynamically inside your procedure.
Also, you could use the MODEL clause, as suggested in the following article:
Discuss This Question: