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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Join tables with full outer join

2942624Sep 19 2018 — edited Sep 19 2018

Hi,

I have a requirement to get 4 columns as export. These 4 columns are in 4 tables (each table has only one column 'Name').

I have used below query for the same

select DR.name as BUDR,HQ.name as BUHQ,ME.name as BUME, SB.name as BUSB

  from (select name,rownum as rn from BU_01_VW) DR

      full outer join

     (select name, rownum as rn from BU_02_VW) HQ using (rn)

     full outer join

     (select name, rownum as rn from BU_03_VW) ME using (rn)

     full outer join

     (select name, rownum as rn from BU_04_VW) SB using (rn)

    

I get result as follows

for BUME , I get null values in between values, it's good for other columns.  Can one please suggest if I am missing something in the logic

    

BUDRBUHQBUMEBUSB
BU_AV01BU_AVA1BU_AV11BU_AV21
BU_AV02BU_AVA2BU_AV12BU_AV22
BU_AV03BU_AVA3BU_AV13BU_AV23
BU_AV04BU_AVA4BU_AV14BU_AV24
BU_AV05BU_AVA5BU_AV15BU_AV25
BU_AV06BU_AVA6BU_AV16BU_AV26
BU_AVA7nullBU_AV27
BU_AVA8BU_AV17BU_AV28
BU_AVA9nullBU_AV29
nullBU_AV30
BU_AV18BU_AV31
BU_AV19BU_AV32
nullBU_AV33
BU_AV20BU_AV34
BU_AV35
BU_AV36
BU_AV37
BU_AV38

Thanks in advance

This post has been answered by mathguy on Sep 19 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2018
Added on Sep 19 2018
9 comments
880 views