This content has been marked as final. Show 5 replies
vishnu prakash wrote:Number of column of a select query is static. Must be known at the parsing time itself. But in your case i dont think the number of columns will be limited to 2 (10 and 20) there could be many more.
I have the query like below
I want the result set in a format of Row To columns like
SELECT d.department_id, CURSOR(SELECT e.first_name, e.last_name FROM employees e WHERE e.department_id = d.department_id ) emps FROM depatments d
pls give ur suggestions how to achieve this in a efficient way?I tried the method of "max(decode(.." but dont think so its possible with this
10 20 <cursor result> <cursor result>
You can search this forum to see how to PIVOT your data. There are lot of example. You can also try dynamic pivot. Its all in here, just search.