LarrySteele
Programmer
I'm trying to transpose a query resultset and I'm struggling finding what I'm looking for in Google.
I'm developing an in-house application that inventories applications that our division supports. The inventory will include bringing in information from disparate data sources and pushing everything on a few web pages. Not rocket science...for the most part.
I'm struggling with one of these data sources, which is a spreadsheet that's approaching 100 columns, of which, the business is interested in 30. Easy enough to bring that into Oracle, but displaying that many columns on a webpage is...unwieldy.
Fortunately, this data source will return one and only one row per application, which makes it a candidate for transposing rows (including field names) to columns. The result set would have two columns: field name and field data. Hopefully the following sample will clarify:
Here's what a record might look like in the table:
[pre]ID APP_NAME APP_DESCRIPTION FIELD4 FIELD30
1000 Data Dyamics Lorem ipsum dol... Foo Bar[/pre]
Here's what I'd like to see in the query's result set:
[pre]ID 1000
APP_NAME Data Dyamics
APP_DESCRIPTION Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris blandit.
FIELD4 Foo
... ...
FIELD30 Bar[/pre]
I don't know if that's doable in an Oracle query and that's okay. There are plenty of other ways of getting the same result but I figured I'd start with the query.
Thanks in advance for any suggestions.
I'm developing an in-house application that inventories applications that our division supports. The inventory will include bringing in information from disparate data sources and pushing everything on a few web pages. Not rocket science...for the most part.
I'm struggling with one of these data sources, which is a spreadsheet that's approaching 100 columns, of which, the business is interested in 30. Easy enough to bring that into Oracle, but displaying that many columns on a webpage is...unwieldy.
Fortunately, this data source will return one and only one row per application, which makes it a candidate for transposing rows (including field names) to columns. The result set would have two columns: field name and field data. Hopefully the following sample will clarify:
Here's what a record might look like in the table:
[pre]ID APP_NAME APP_DESCRIPTION FIELD4 FIELD30
1000 Data Dyamics Lorem ipsum dol... Foo Bar[/pre]
Here's what I'd like to see in the query's result set:
[pre]ID 1000
APP_NAME Data Dyamics
APP_DESCRIPTION Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris blandit.
FIELD4 Foo
... ...
FIELD30 Bar[/pre]
I don't know if that's doable in an Oracle query and that's okay. There are plenty of other ways of getting the same result but I figured I'd start with the query.
Thanks in advance for any suggestions.