External integration of Oracle commands

Source: Internet
Author: User

Oracle External combined command:The most important thing to understand (+) is that (+) is always placed on the side where information is scarce, and records on this side are displayed as null values.

Example:

First, preview the two tables that we will combine: EMPLOYEE_CHECK and EMPLOYE_CHECK_TMP.

@ _ 1 TableEMPLOYEE_CHECK:

  1. SQL>SELECT*FROMEMPLOYEE_CHECK;
  2. EMP_ID EMP_NAME EMP_ST_ADDR EMP_ZIP EMP_ADDR EMP_CITY EMP_PHONE EMP_SALRAY
  3. -------------------------------------------------------------------------------------------------------------------------------
  4. 100000 zou qi lei ban tian bulong street 518000 yang mei village shen zhen 123456789 3500
  5. 100001 cai fang jie ban tian bulong street 518000 yang mei village shen zhen 18218429577
  6. 100002 lu jing huan fan yu session 430060 yang mei village guang zhou 1397165903
  7. 100003 wu jing xin hu bei dier shifan xueyuan 430060 ming zhu yuan wu han 187 *** 235
  8. 100004 li wei qing shan gang du hua yuan 430060 xiao qu wu han 197 *** 436

@ _ 2 Table EMPLOYEE_CHECK_TMP:
  1. SQL>SELECT*FROMEMPLOYEE_CHECK_TMP;
  2. EMP_ID EMP_NAME EMP_ST_ADDR EMP_ZIP EMP_ADDR EMP_CITY EMP_PHONE EMP_SALRAY
  3. -------------------------------------------------------------------------------------------------------------------------------
  4. 100001 cai fang jie ban tian bulong street 518000 yang mei village shen zhen 18218429577
  5. 100003 wu jing xin hu bei dier shifan xueyuan 430060 ming zhu yuan shen zhen 187 *** 235
  6. 100005 ding ling han kou tai bei lu 430060 tian men dun nearby wu han 137 *** 4256 2000

Now we can combine the two tables and use '+' for combined queries:
  1. SQL>SELECTP. EMP_NAME, P. EMP_ADDR, P. EMP_CITY, P. EMP_PHONE,T. EMP_ZIPFROMEMPLOYEE_CHECK P, EMPLOYEE_CHECK_TMP TWHERE<Span style ="Color: # ff6600 ;"> P. EMP_ID </span> <span style ="Color: # 3366ff ;"> </Span> = <span style ="Color: # 3366ff ;"> T. EMP_ID (+ );
  2. EMP_NAME EMP_ADDR EMP_CITY EMP_PHONE EMP_ZIP
  3. ------------------------------------------------------------------------------
  4. Zou qi lei yang mei village shen zhen 123456789-- Row_1
  5. Cai fang jie yang mei village shen zhen 18218429577 518000
  6. Lu jing huan yang mei village guang zhou 1397165903-- Row_3
  7. Wu jing xin ming zhu yuan wu han 187 *** 235 430060
  8. Li wei xiao qu wu han 197 *** 436-row_5
Now, observe the two tables that are combined with the query. The primary table (P) is marked in red and the query field is:
  1. P. EMP_NAME, P. EMP_ADDR, P. EMP_CITY, P. EMP_PHONE
The temporary table (T) is marked in blue and the query field is:

T. EMP_ZIP

When '+' (combined with the flag) is attached to the T table, except that the where p. EMP_ID = T. in addition to EMP_ID information, the query fields corresponding to P are also returned: row_1, row_3, and row_5.

  • 1
  • 2
  • Next Page

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.