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!

Alternative to UNION ALL ?

Eric999Aug 4 2017 — edited Aug 7 2017

I have the following query, and I'm curious if there's an alternative to UNION ALL. It seems like it would be a candidate to UNPIVOT, but I can't get it to work. Any suggestions?

SELECT

    'AA' AS column1,

     NULL AS column2,

     NULL AS column3,

     NULL AS column4,

     NULL AS column5,

     NULL AS column6,

     NULL AS column7,

     NULL AS column8,

     NULL AS column9,

     NULL AS column10

FROM

     DUAL

UNION ALL

SELECT

    'BB' AS column1,

     NULL AS column2,

     NULL AS column3,

     NULL AS column4,

     NULL AS column5,

     NULL AS column6,

     NULL AS column7,

     NULL AS column8,

     NULL AS column9,

     NULL AS column10

FROM

      DUAL

UNION ALL

SELECT

    'CC' AS column1,

     NULL AS column2,

     NULL AS column3,

     NULL AS column4,

     NULL AS column5,

     NULL AS column6,

     NULL AS column7,

     NULL AS column8,

     NULL AS column9,

     NULL AS column10

FROM

     DUAL

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2017
Added on Aug 4 2017
16 comments
3,450 views