DBAsupport.com Forums - Powered by vBulletin
Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Pivot data in PL/SQL procedure

  1. #1
    Join Date
    Aug 2004
    Posts
    26

    Pivot data in PL/SQL procedure

    Hi,

    I have data like this in a table

    Opp_Id line_Id group_id Approval_id
    ---------------------------------------------
    48941 148270 6501 6
    48941 149014 2354 11
    48941 150624 6123 6
    48941 228609 7180 11

    and I need to pivot this data in another table
    like this

    Opp_id 6_line_id 11_line_id 6_group_id 11_group_id
    ---------------------------------------------------------------------
    48941 148270 149014 6501 2354
    48941 150624 228609 6123 7180

    Please help me as I am stuck here...

    Thanks in advance
    -Patni

  2. #2
    Join Date
    Jan 2002
    Posts
    78
    use the insert into newtable --- select col2,col3 from oldtable

  3. #3
    Join Date
    Aug 2004
    Posts
    26
    No.. I need to pivot the data,
    select col2, col3 from old data will not achieve this

    Any other suggestions

    - Patni

  4. #4
    Join Date
    Sep 2001
    Posts
    52
    how do you know which "Approval_ID=6" to be linked with which "Approval_ID=11" ?

  5. #5
    Join Date
    Aug 2004
    Posts
    26
    The user will enter data for Approval. It might be that he will enter record for 6 then for 11 OR for 11 and then 6. So First 6 and first 11 record are to be pivoted and likewise for the second 6 and second 11. May be by ROWID or Order by Line_Id..

    Please think and reply back...

  6. #6
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Are approval_id =6 and approval_id=11 the only two valid values for this column?
    Jeff Hunter

  7. #7
    Join Date
    Aug 2004
    Posts
    26
    Nope, there are other Approval Id's too, The requirement is to filter only on 6 and 11.

  8. #8
    Join Date
    Aug 2004
    Posts
    26
    Hello.Hello...Any suggestions. I got to complete it by Tomorrow..
    PLease suggest something..

    How do I align the Approval Id 6 and 11 records for a given Opp_Id if there are multiple Approval Id 6 and 11 records.
    If there is only one set I can align them in a cursor by calling the local procedures for 6 and 11 record and then finally inserting the data.

    But when there are multiple rows of 6 and 11 how do I do it???????


    - Patni

  9. #9
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    Why should we care when has this to be completed?

  10. #10
    Join Date
    Aug 2004
    Posts
    26
    ok...I need help. Thinking about it, I feel it is a chalenging query. I am trying to get hold of it but in vain.

Posting Permissions

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


Click Here to Expand Forum to Full Width