ORA-01719: outer join operator (+) not allowed in operand of OR or IN [message #613880] |
Tue, 13 May 2014 06:28  |
 |
akifdadan
Messages: 1 Registered: May 2014 Location: Pune
|
Junior Member |
|
|
My query is
SELECT
s.SIT_ID, -- identifiant du site
s.SIT_NUMG2R, -- LPAD removed due to G2R code extension
s.SIT_ZPID, --ZP SITE CODE -- Ran Sharing Lot 1
s.SIT_NOM, -- NOMSITE
s.SIT_COOXSIM, -- X_SIMU_SITE
s.SIT_COOYSIM, -- Y_SIMU_SITE
s.SIT_COOZSIM, -- Z_SIMU_SITE
s.REG_NUM, -- REGION
s.DEP_NUM, -- DEPART
NVL( z.ZGE_LIB, '') -- ZONE_MKG
FROM
SITE s,
ZONEGEO z,
REGION reg
WHERE
s.SIT_NUMG2R IS NOT NULL -- Le numero du site n'est pas vide
AND s.ZGE_ID = z.ZGE_ID (+)
AND s.REG_NUM = reg.REG_NUM
AND reg.REG_VIRT = 0
OR (s.sit_zpid is not null and s.sit_zpid not like 'ZP%');
The error that am getting is as follows :
ORA-01719: outer join operator (+) not allowed in operand of OR or IN
01719. 00000 - "outer join operator (+) not allowed in operand of OR or IN"
*Cause: An outer join appears in an or clause.
*Action: If A and B are predicates, to get the effect of (A(+) or B),
try (select where (A(+) and not B)) union all (select where (B)).
Error at Line: 19 Column: 17
Can some one help me with the correct query ?
|
|
|
Re: ORA-01719: outer join operator (+) not allowed in operand of OR or IN [message #613881 is a reply to message #613880] |
Tue, 13 May 2014 06:37   |
 |
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Welcome to the forum..
please use the formatter http://www.dpriver.com/pp/sqlformat.htm
SELECT s.sit_id,-- identifiant du site
s.sit_numg2r,-- LPAD removed due to G2R code extension
s.sit_zpid,--ZP SITE CODE -- Ran Sharing Lot 1
s.sit_nom,-- NOMSITE
s.sit_cooxsim,-- X_SIMU_SITE
s.sit_cooysim,-- Y_SIMU_SITE
s.sit_coozsim,-- Z_SIMU_SITE
s.reg_num,-- REGION
s.dep_num,-- DEPART
Nvl(z.zge_lib, '') -- ZONE_MKG
FROM site s,
zonegeo z,
region reg
WHERE s.sit_numg2r IS NOT NULL -- Le numero du site n'est pas vide
AND s.zge_id = z.zge_id (+)
AND s.reg_num = reg.reg_num
AND reg.reg_virt = 0
OR ( s.sit_zpid IS NOT NULL
AND s.sit_zpid NOT LIKE 'ZP%' );
Please check this link http://www.techonthenet.com/oracle/errors/ora01719.php
[Updated on: Tue, 13 May 2014 06:40] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: ORA-01719: outer join operator (+) not allowed in operand of OR or IN [message #613906 is a reply to message #613905] |
Tue, 13 May 2014 08:23   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
@akifdadan - I think you're missing some brackets. Your where clause is logically equivalent to:
WHERE (s.sit_numg2r IS NOT NULL -- Le numero du site n'est pas vide
AND s.zge_id = z.zge_id (+)
AND s.reg_num = reg.reg_num
AND reg.reg_virt = 0
)
OR (s.sit_zpid IS NOT NULL
AND s.sit_zpid NOT LIKE 'ZP%' );
So either the 1st 4 lines must be true, or the last 2.
I doubt that's what you want and the OR should only be applied to one of the preceding lines, maybe this:
WHERE s.sit_numg2r IS NOT NULL -- Le numero du site n'est pas vide
AND s.zge_id = z.zge_id (+)
AND s.reg_num = reg.reg_num
AND (reg.reg_virt = 0
OR (s.sit_zpid IS NOT NULL
AND s.sit_zpid NOT LIKE 'ZP%'
)
);
|
|
|
|
|
|