Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    Unanswered: Can't write a Query

    Hi,
    I am trying to display one column values into 8 columns but based on title. Now problem is:

    Table 'A' has 4 fields DB_CONTRACT ,ITEM_NO , BRK_TITLE, BRK_QUANT.

    when brk_title would change for perticulare db_contract and item_no a new column should create and quantity for that column would display under that title. In this way I wanna see eight columns under related brk_title.

    I hope you get my scenario.

    Plz help me ....
    mr_roomi

  2. #2
    Join Date
    Feb 2004
    Posts
    37

    Re: Can't write a Query

    Use dynamic sql to add the columns on runtime.
    Write a PL/SQL block to validate the column values and within the block
    do the following..
    EXECUTE IMMEDIATE 'Alter table table_name add(col1,...)

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    post your data and how you want to see it.

    I believe we are talking about a pivot query here.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Mar 2004
    Location
    Maryland
    Posts
    152

    query data

    hi,

    lets say i have three type titles homes, commerical, govt . I have one table and with all mix quantities and in brk_quant column. I want display related quantities under related titles.

    remember title is one colum of same table.

    DB_CONTRACT
    ITEM_NO
    BRK_TITLE ------title should be heading
    BRK_QUANT ------ detail under each heading.


    I hope I convey my point.

    plz help
    mr_roomi

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    you convey your point fine, but I need the table description, what
    columns you want to display and at least ALL distinct BRK_TITLEs

    this is how I would like you to display this stuff:
    (this is the most easy to read format)
    PHP Code:
    platform@kod1desc organization
     Name                                   Null
    ?    Type
     
    -------------------------------------- -------- -------------------------
     
    ORG_ID                                 NOT NULL VARCHAR2(30)
     
    DESC_TXT                               NOT NULL VARCHAR2(30)
     
    INTERVAL_MIN_NBR                                NUMBER(4)
     
    MISS_THRSHLD_NBR                                NUMBER(4)
     
    RDNG_PRCSN_NBR                                  NUMBER(4)
     
    CUST_TZ_CD                             NOT NULL VARCHAR2(30)
     
    DFLT_THERM_FCTR                                 NUMBER(9,7)
     
    TEMP_TYPE_CD                                    VARCHAR2(1)
     
    CONTENT_TYPE_CD                                 VARCHAR2(50)
     
    CONTENT_ID                                      NUMBER(8)
     
    ROOT_CONTENT_ID                                 NUMBER(8)
     
    LIQUID_UNIT_CD                                  VARCHAR2(10)

    platform@kod1select distinct org_id from organization;

    ORG_ID
    ==========
    4
    Cels
    DW
    ENS
    ESU
    ETL
    ETU
    FT
    FTEST 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •