关闭

Oracle数据库中的(+)连接

560人阅读 评论(0) 收藏 举报
1. 从表A.A1 (+) =  主表B.B1
SELECT
  TO_CHAR(TBA.FBS_IO_DATE,'YYYY/MM/DD') A1
  ,TBA.TBA_TBD_NO A2
  ,TBB.TBB_NAME_S A3
  ,TBC.TBC_CHAR1 A4
  ,TBD.TBD_NAME A5
  ,TBA.TBA_SNS_NAME_SP A6
  ,TBA.TBA_TORI_KIN A7
  ,TO_CHAR(TBA.TBA_RPL_DATE,'YYYY/MM/DD') A8

 FROM
  SNTBATRN TBA
  ,ZMTBCMST TBC
 ,CMTBBMST TBB
  ,CMTBDMST TBD
 WHERE
  TBA.TBA_KAI_CODE = 'XXX'
  AND TBA.TBA_KESHI_KBN = '0'
  AND TBA.TBA_TAISYO_KBN IN ('0', '2')
  AND TBB_KAI_CODE (+) =  'XXX'
  AND TBB_BUN_CODE (+) = 'S001'
  AND TBB_START_DATE <= SYSDATE
  AND TBB_END_DATE >= SYSDATE
 AND TBB.TBB_CODE (+)= TBA.TBA_STN_CODE
  AND TBC.TBC_KAI_CODE (+) = 'XXX'
  AND TBC.TBC_SUB_KBN (+) = 'SN'
 
 AND TBD.TBD_KAI_CODE (+) = 'XXX'
  AND TBD.TBD_CODE (+) = TBA.TBA_SNS_CODE 
SELECT
  TO_CHAR(TBA.FBS_IO_DATE,'YYYY/MM/DD') A1
  ,TBA.TBA_TBD_NO A2
  ,TBB.TBB_NAME_S A3
  ,TBC.TBC_CHAR1 A4
  ,TBD.TBD_NAME A5
  ,TBA.TBA_SNS_NAME_SP A6
  ,TBA.TBA_TORI_KIN A7
  ,TO_CHAR(TBA.TBA_RPL_DATE,'YYYY/MM/DD') A8

 FROM
  SNTBATRN TBA
  ,ZMTBCMST TBC
 ,CMTBBMST TBB
  ,CMTBDMST TBD
 WHERE
  TBA.TBA_KAI_CODE = 'XXX'
  AND TBA.TBA_KESHI_KBN = '0'
  AND TBA.TBA_TAISYO_KBN IN ('0', '2')
  AND TBB_KAI_CODE (+) =  'XXX'
  AND TBB_BUN_CODE (+) = 'S001'
  AND TBB_START_DATE <= SYSDATE
  AND TBB_END_DATE >= SYSDATE
 AND TBB.TBB_CODE (+)= TBA.TBA_STN_CODE
  AND TBC.TBC_KAI_CODE (+) = 'XXX'
  AND TBC.TBC_SUB_KBN (+) = 'SN'
 
 AND TBD.TBD_KAI_CODE (+) = 'XXX'
  AND TBD.TBD_CODE (+) = TBA.TBA_SNS_CODE 
 2.  主表A.A1 =  从表B.B1 (+)
SELECT
 TBA.TBA_1,
 TBB.TBB_1,
 TBC.TBC_1
FROM
 TBA,
 (SELECT TBB.TBB_1, TBB.TBB_2
  FROM TBB
  WHERE
  TBB.TBB_3 LIKE '%NEWWEAPON%' TBB),
 TBC
WHERE
 //主表TBC
 TBA.TBA_A > 2
 //从表TBB
 AND TBA.TBA_2 = TBB.TBB_2
 //从表TBC
 //注意TRIM
 AND TRIM(TBA.TBA_3) = TRIM(TBC.TBC_3 (+))
 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:337214次
    • 积分:4530
    • 等级:
    • 排名:第6934名
    • 原创:94篇
    • 转载:207篇
    • 译文:3篇
    • 评论:12条
    最新评论