Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:30:08+00:00 2026-05-30T07:30:08+00:00

Hi I have a table test its structure is given below: **Testing** PK C1

  • 0

Hi I have a table test its structure is given below:

**Testing**

  PK    C1    c2  
 ---------------
 1      v11  v12
 2      v21  v23
 3      v31  v32

Now I need to query this table (testing) such that I get the below output.

 Pk  Key value 
---------------
 1    c1    v11
 1    c1    v12
 2    c2    v21
 2    c2    v22
 3    c3    v31
 3    c3    v32

Can this been possible with sql query in Oracle 11g ,Is it possible with PIVOT feature in 11g?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:30:09+00:00Added an answer on May 30, 2026 at 7:30 am

    No, it can’t be done with PIVOT, but it can be done with UNPIVOT:

    SELECT
      Pk,
      "Key",
      value
    FROM Testing
    UNPIVOT (
      value FOR "Key" IN (C1, C2)
    )
    

    And when UNPIVOT is unavailable, I often unpivot like this:

    SELECT
      t.Pk,
      x."Key",
      CASE x."Key"
        WHEN 'C1' THEN t.C1
        WHEN 'C2' THEN t.C2
      END AS value
    FROM Testing t
    CROSS JOIN (
      SELECT 'C1' AS "Key" FROM DUAL UNION ALL
      SELECT 'C2' FROM DUAL
    ) x
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have table to test score data that I need to pivot and I
I have a table defined by the following SQL: CREATE TABLE test ( id
I have the following table: CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1)) INSERT INTO
I have a table which stores test results like this: user | score |
I have created a test table in MySQL and would like to insert 10
I have the following test-code: CREATE TABLE #Foo (Foo int) INSERT INTO #Foo SELECT
We have a general organizational table structure, think of it s a Tree or
I have a single table in database, with a structure like: Id | Name
I have some code like this: <h2 id=a>Header</h2> <table> <tr> <td>test</td> </tr> </table> <h2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.