Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamically converting rows to columns

455054Apr 1 2009 — edited Apr 1 2009

Hi all,

I am managed to convert rows to column with your help and works fine for now. My concern is the rows that I would like to convert to columns are not known during design time and I would like to work with dynamic
query to find out my rows before I convert it to columns and avoid hardcoding the rows in my sql code. Can someone help me to conver this query to daynamic or point me to a tutorial where I can learn how to 
here is my query and I really appreciate for your help

  SELECT IPLINENO "BLine Number",
       
        MAX(CASE WHEN VENDOR='K020'  THEN to_char(bidprice,'$99,999,999.99') ELSE NULL END) "K020",                 
        MAX(CASE WHEN VENDOR='H438'  THEN to_char(bidprice,'$99,999,999.99') ELSE NULL END) "H438",        
        MAX(CASE WHEN VENDOR='U010'  THEN to_char(bidprice,'$99,999,999.99') ELSE NULL END) "U010",
        MAX(CASE WHEN VENDOR='G110'  THEN to_char(bidprice,'$99,999,999.99') ELSE NULL END) "G110",    
        MAX(CASE WHEN VENDOR='H530'  THEN to_char(bidprice,'$99,999,999.99') ELSE NULL END) "H530"
      
    FROM  BIDTABS
    WHERE LETTING='&letting'
          AND CALL='&call' 
          AND BIDPRICE <> 0
    GROUP BY IPLINENO
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2009
Added on Apr 1 2009
10 comments
773 views