1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Pivot in oracle 11g

Discussion in 'SQL PL/SQL' started by JACK, Dec 10, 2011.

  1. JACK

    JACK Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    Hi All,

    Can we use pivot in oracle 11g to display the column values dynamically. if so please provide the script or procedure .
    If not do we have any functions/procedure to do it.
     
  2. JACK

    JACK Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    Hi All,
    Can you pls help me. It is urgent.

    Thanks in Advance.
     
  3. JACK

    JACK Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    Hi All,
    Please Let me know if my question is unclear
     
  4. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    Hi,

    The below example explains how pivoting concept works:

    SELECT * FROM (SELECT EMP_NAME,EMP_JOB FROM EMPLOYEE GROUP BY EMP_NAME,EMP_JOB) PIVOT(COUNT(EMP_NAME) FOR EMP_JOB IN
    ('MANAGER','CLERK'));

    In this example we have taken employee name and his job and then counting how many employees are there based on jobs. This works with 11g.

    Thanks,
    Bharat G.
     
  5. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Pivot Works in SQL . No need for Procedure or function. Please refer the link here.
     
  6. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
  7. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Hmhm.. yes.

    Thanks for reminding me about it. :) Btw, It is long time since my last article in club oracle. I will try to contribute another one soon.
     
    Sadik likes this.
  8. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
    Thanks... I have also been so busy with other work, Club Oracle has been a bit neglected. I am trying to get some new developments done for the site to attract more members. I have long wanted a LinkedIN integration module for the site, I am planning to get it developed in January. I had planned it earlier too but had to abandon it.