aspose file tools*
The moose likes Oracle/OAS and the fly likes Oracle Pivot table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Oracle Pivot table" Watch "Oracle Pivot table" New topic
Author

Oracle Pivot table

Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
I have a problem with an application that I am attempting to create of a legacy table of data. The table format is

datetime(timestamp) value_id(int) value(float).

I need to transform this into the following resultset filtered by a set of at most 9 value_id.

datetime, value_id_1,value_id_1,...,value_id_9

the row values will be datetime with the corresponding float value for the id which is not the column name. I believe I need to use a pivot table but am unfamiliar with this type of solution. If anyone could provide sample code or point me in the right direction that would be great. I can not modify the data structure but can accomplish this with the use of stored procedures on Oracle 9i Standard edition

Thanks in advance...

Jeremy


Jeremy Wilson
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Jeremy,

From a quick Google, Oracle 9i pivot table syntax is as follows:

Generates 100 rows numbered 1 to 100.

I'm not sure how this helps you with your problem, however.
I've solved that kind of problem before. If you feel you need more help I'll try and remember how.

Jules
Jeremy Wilson
Ranch Hand

Joined: Feb 18, 2003
Posts: 166
What is pivot_package a part of. Do not believe it is part of Oracle Standard edition
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Dunno. Try searching Oracle's web site.

No matter. You can achieve the same effect with the following code:

I'd be interested to know how this helps solve the problem.

Jules
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hmmm, that's what happens when you skim an article. Here is the code for pivot_package and its dependencies from oracle.com:

Enjoy!

Jules
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Oracle Pivot table