How Oracle databases implement left and right outer-union

Source: Internet
Author: User

Create or replace view V_wtk_all as

Select a.ID, O.short as Finddeptname, u.realname as Findusername, f.name as Findway, O1.short as Problematdeptname,

Z.name as Szzz, A.yhnr, s.name as Sszy, k.name as kind, w.name as WHHG, A.zgcs, A.ZGFZR, A.plandate, A.finishdate,

U1.realname as JDR, u2.realname as FXR, A.yqzt, A.yqdate, A.WTKZT

From WTK A, organization O, organization O1, OPERATORS u,operators u1,operators U2, Kind K, Findway F, SPField S, Szzz Z, WHHG W

where A.finddeptid =o.id (+) and a.problematdeptid=o1.id (+) and a.finduserid=u.id (+) and a.jdr=u1.id (+) and (+) and a.fxr=u2.id (+ )

and A.kindid=k.id (+) and a.findwayid=f.id (+) and a.spfieldid=s.id (+) and A.szzid =z.id (+) and a.whhgid=w.id (+)

has two tables

Table1

USER_ID user_name User_ps Tutorial S

1 AAA A

2 BBB b

3 CCC C

Table2

USER_ID User_power

1 111000

2 000111

Querying using SQL statements

Normal state:

Select table1.user_id,

Table1.user_name,

Table2.user_power

From Table1,table2

where table1.user_id = table2.user_id

But this retrieves only two of the data:

USER_ID user_name User_power

1 AAA 000111

2 BBB 111000

Enter the text you want to convert,

Click on the button below to convert online.

Select Table1.user_id,table1.user_name,table2.user_power

From Table1,table2

where table1.user_id (+) = table2.user_id

We can get the following results

USER_ID user_name User_power

1 AAA 000111

2 BBB 111000

3 CCC (NULL)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.