oracle中
浪潮軟體有個功能(pb開發的client端軟體),點選時報錯:
ORA-01719: OR 或 IN 運算元中不允許外部聯接運算子 (+)
SELECT 'L', KCXED1_LSBH, KCXED1_DJRQ, KCXED1_SJDH, KCXED1_BMBH, KCXED1_JHBH, KCXED1_CPBH, KCXED1_CPBH, LSWLZD_GGXH, KCXED1_CPSL, KCXED1_CPPC, KCXED1_LRXM, KCXED1_BZ, KCXED1_KCXM, KCXED1_KCSH, KCXED1_KCRQ, KCXED1_KCJZ, KCXED1_WCBZ, KCXED1_CPRQ, KCXED1_C1, KCXED1_C2, KCXED1_C3, KCXED1_C4, KCXED1_C5, KCXED1_U1, KCXED1_U2, KCXED1_U3, KCXED1_SFQR, KCXED1_KCXGSJ, KCXED1_YWBS, KCXED1_DWGC, KCXED1_DWGC, LSWLZD_C1, LSWLZD_C2, LSWLZD_C3, LSWLZD_C4, LSWLZD_C5, LSWLZD_U1, LSWLZD_U2, LSWLZD_U3 from KCXED1,LSWLZD where KCXED1_CPBH = LSWLZD_WLBH(+) AND KCXED1_DJRQ>='20090201' AND KCXED1_DJRQ<='20090216' AND NVL(KCXED1_SJDH,' ') = '09020023' or NVL(KCXED1_SJDH,' ') = '09020030'
此語句的where 條件中,是這麼寫的:
where KCXED1_CPBH = LSWLZD_WLBH(+) AND KCXED1_DJRQ>='20090201' AND KCXED1_DJRQ<='20090216' AND NVL(KCXED1_SJDH,' ') = '09020023' or NVL(KCXED1_SJDH,' ') = '09020030'
也就是用了外連線(OUTER JOIN),只不過 KCXED1_CPBH = LSWLZD_WLBH(+) 是左外連線,這個有點搞笑,左外連線時,"+"放在=的右邊.呵呵....不知道oracle為啥這麼放...
例項:
CREATE TABLE departments
(
depID NUMBER(38,0),
depName VARCHAR2(20),
delFlag NUMBER(1,0)
);
select * from departments
select * from employees
CREATE TABLE employees
(
empID NUMBER(38,0),
empName VARCHAR2(20),
depID NUMBER(38,0),
delFlag NUMBER(1,0)
);
INSERT INTO departments VALUES(1,'Finacle',0);
INSERT INTO departments VALUES(2,'Marketing',0);
INSERT INTO departments VALUES(3,'HR',1);
INSERT INTO departments VALUES(4,'IT',0);
INSERT INTO employees VALUES(1,'wbq',1,0);
INSERT INTO employees VALUES(2,'czh',2,0);
INSERT INTO employees VALUES(3,'chh',1,0);
INSERT INTO employees VALUES(4,'wal',2,0);
INSERT INTO employees VALUES(5,'ddd',3,0);
COMMIT;
請執行
select * from employees e , departments d where e.depid = d.depid(+)
和
select * from employees e , departments d where e.depid (+) = d.depid
比較一下,這2個sql的異同
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/161195/viewspace-588623/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 中$ORACLE_HOME/bin/oracle檔案Oracle
- Oracle中的publicOracle
- Oracle 中的userenv()Oracle
- Oracle中的段Oracle
- Oracle中的鎖Oracle
- oracle中修改processOracle
- Oracle中Kill sessionOracleSession
- oracle中top用法Oracle
- oracle中的簇Oracle
- Oracle中的jobOracle
- oracle中的角色Oracle
- oracle中的nullOracleNull
- Oracle中with的用法Oracle
- Oracle中的SCNOracle
- Oracle中的rownumOracle
- Oracle中group by用法Oracle
- [Oracle] Oracle RAC中local_listener指定Oracle
- Oracle中Kill session的研究 for oracle -- 轉OracleSession
- oracle 11g中的 oracle restart特性OracleREST
- Oracle Flashback Archive——Oracle閃迴歸檔(中)OracleHive
- Docker中安裝OracleDockerOracle
- Oracle 中的exception——(Raise)OracleExceptionAI
- oracle 中的事務Oracle
- ORACLE中index的rebuildOracleIndexRebuild
- 【 Oracle中rownum的用法 】Oracle
- Oracle中的並行Oracle並行
- 剖析Oracle中oerr命令Oracle
- oracle中的cluster表Oracle
- oracle中schema的概念Oracle
- oracle中的exists理解Oracle
- Oracle中Hint隨記Oracle
- Oracle中的sql%rowcountOracleSQL
- oracle中的asm文化OracleASM
- oracle中的約束Oracle
- Oracle中Sequence的使用Oracle
- ORACLE中的時區Oracle
- Oracle中RAISE異常OracleAI
- ORACLE中的KILLED SESSIONOracleSession