Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Oracle query- rows like columns

Posted on 2014-02-14
7
Medium Priority
?
351 Views
Last Modified: 2014-02-28
select count(unit_id),procedure_code,site_name
  from donations@pdon_new don,
       drives@pdon_new dr,
         sites s
 where coll_date  between '01-jan-2014' and '12-feb-2014'
   and don.drive_id = dr.drive_id
   and s.lt_location_id = dr.location_id
   and dr.location_id = 'LOCN100008'
   and don.unit_id is not null
   and don.donation_type = 'AL'
   and don.donor_id in (select donor_id
                          from hbc_donor_schedule sched
                         where sched.donation_type = 'AL'
                           and sched.status = 'CNFRM'
                           and sch_date > don.coll_date)
                                       group by procedure_code,site_name;

COUNT(UNIT_ID),    PROCEDURE_CODE,    SITE_NAME
        33,                      CO,                         Aurora Donor Center
          4,                      DR,                         Aurora Donor Center
          3,                      PL,                          Aurora Donor Center
       168,                     PP,                          Aurora Donor Center
          2,                      RP,                          Aurora Donor Center
          5,                      RS,                          Aurora Donor Center
        64,                      WB,                        Aurora Donor Center

I wanted the display to be as shown below

Aurora Donor Center  CO   DR  PL    PP     RP   RS    WB

                                   33    4     3   168    2    5     64
0
Comment
Question by:anumoses
  • 3
  • 3
7 Comments
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1500 total points
ID: 39859371
You have to have a fixed number of columns.  They cannot be dynamic.

Will you have fixed rows to convert?
0
 
LVL 6

Author Comment

by:anumoses
ID: 39859387
No
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39859438
Then I do not believe you can do what you want.

You can generate a CSV or other delimited string then parse it out from the application but even with the application, you will likely need to know how many fields you will have.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:anumoses
ID: 39877226
I've requested that this question be deleted for the following reason:

I have a feeling that this question can be deleted as there is no possibility of getting what is required.
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39877227
I believe you did get the answer to the question you asked.

Please review:  The experts told me “you can’t do that”. What do I do now?
http://support.experts-exchange.com/customer/portal/articles/755964
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39895561
NA
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question