Schema Query Design Help
Posted by: jed davidow
Date: March 05, 2007 01:14PM

(This is a question about SQL coding and possibly DB design. Please let me know if it's in the wrong forum, thanks)

I have a need to store information about rejected units. I will then also need to create a report based on this data. Here's my current design and an example of the report (I am keeping the descriptions simple for this example).

Reject Table
=====
unit_id
rejDate
rejCode
rejOperator
rejComment

Report Example:

Month | Code_1 | Code_2 | Code_3
================================
Jan | 25 | 20 | 34
Feb | 20 | 33 | 0
Mar | 21 | 2 | 12
Apr | 16 | 11 | 29

The code categories will change over time, and I would like to order the columns in order from most total rejects to lowest. I also only need, say, the top three columns.

Right now I am generating the SQL in code, after running queries to get the column names. It works, but requires many calls from code to the DB, temp table, etc. I would like to do it all within a procedure if possible.

Is this possible? Can I LEFT JOIN and create columns dynamically in a procedure?

Options: ReplyQuote


Subject
Written By
Posted
Schema Query Design Help
March 05, 2007 01:14PM
April 29, 2007 06:51AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.