Have unpivot automatically grab column list (oracle 11g)?

You could create a stored procedure to do this in PL/SQL by dynamically creating your SQL statement as a string an then using execute immediate to execute it and return a cursor.

Up vote 1 down vote favorite share g+ share fb share tw.

This is a follow up question to stackoverflow.com/questions/2344403/tran... I want to be able to unpivot an arbitrary query result. To unpivot a table manually, I would do: select value_type, value from ( ( -- query to be unpivoted -- EG: select col1, col2, col3, col4, col5 from table ) unpivot ( -- Line I would like to change value for value_type in (col1, col2, col3, col4, col5) ) ); This works for all queries that return 5 columns, called col1, col2, etc. Is there something I put in instead of value for value_type in (col1, col2, col3, col4, col5) that will grab all the column names from the query/view/table that is selected in the first part? Sql oracle oracle11g unpivot link|improve this question asked Feb 26 '10 at 21:40David Oneill2,020525 98% accept rate.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions