ORA-01417
Folks please solve my problem
i have these tables in from clause, when am executing my code am getting the error
ORA-01417
Error Description:
a table may be outer joined to at most one other table
TT12_.JE_HEADER_ID(+)=l.JE_HEADER_ID
and TT12_.segment1(+)=c.segment1
and TT12_.segment2(+)=c.segment2
AND TT_.JE_HEADER_ID(+)=l.JE_HEADER_ID
and TT_.segment1(+)=c.segment1
and TT_.segment2(+)=c.segment2
AND TT1_.JE_HEADER_ID(+)=l.JE_HEADER_ID
and TT1_.segment1(+)=c.segment1
and TT1_.segment2(+)=c.segment2How can we join them
Please help me thanks....
Hi,
Use ANSI join syntax. For example:
FROM c
JOIN l ON ...
LEFT OUTER JOIN tt12_ ON TT12_.JE_HEADER_ID = l.JE_HEADER_ID
AND TT12_.segment1 = c.segment1
AND TT12_.segment2 = c.segment2
LEFT OUTER JOIN tt_ ON TT_.JE_HEADER_ID = l.JE_HEADER_ID
AND TT_.segment1 = c.segment1
AND TT_.segment2 = c.segment2
LEFT OUTER JOIN tt1_ ON TT1_.JE_HEADER_ID = l.JE_HEADER_ID
AND TT1_.segment1 = c.segment1
AND TT1_.segment2 = c.segment2
...That error only occurs using the older join notation, with +.
Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Simplify the proble as much as possible. In this case, you can probably show the problem with just 3 tables (c, l, and any one of the others), and just the columns necessary to join them.
Always say which version of Oracle you're using.
Edited by: Frank Kulash on Jul 29, 2011 9:32 AM
Similar Messages
-
OUTER JOIN -- Error: ORA-01417 (a table may be outer joined to at most one
Hi there,
I have a rather simple task: retrieve all the records in a table, for agiven domain p_domain_id (input parameter). The problem is that there are about 6 FKs in the table, and I need the names (strings) corresponding to those FKs (from other tables). Unfortunately, some of the FKs are NULL, so in '=' I loose records. Without the last 2 lines in WHERE clause, I get the correct result. With d2 in place (and without the "(+)" ) I loose 2 records. With the d3 (and also without "(+)"), I do not get any record.
With the "(+)", the code compiles but I get the run time error ORA-01417
NOTE: I put the "+" within parentheses, in order to show it like a text in this editor.
What's an elegant solution to this?
Thanks a lot.
Here's the code:
SELECT
a.DOMAIN,
b.NAME,
a.DE_ID,
a.NAME,
a.PREFERRED_LABEL,
a.TECHNICAL_DEFINITION,
a.PUBLIC_DEFINITION,
a.DE_TYPE,
c1.NAME,
a.HAS_PARAMETER,
a.VALUE_CLASS,
c2.NAME,
a.INDEX_TERMS,
a.DATA_TABLE_ID,
d1.TABLE_NAME,
a.SP_INSERT,
a.SP_UPDATE,
a.SP_GET_BYMRN,
a.SP_GET_BYATTRIBUTE,
a.VALUE_TABLE_ID,
d2.TABLE_NAME,
a.PARAM_TABLE_ID,
d3.TABLE_NAME,
a.PARAM_DOMAIN_LOGIC,
a.SP_LOV,
a.LOWER_LIMIT,
a.UPPER_LIMIT,
a.BOOLEAN_Y,
a.BOOLEAN_N,
a.COMMENTS,
a.ENTERED_BY,
commons_API.get_person_full_name(a.ENTERED_BY),
a.ENTERED_ON
FROM
DATA_ELEMENT_INDEX a,
DE_DOMAIN b,
GENERAL_LIST c1,
GENERAL_LIST c2,
TABLE_GROUP d1,
TABLE_GROUP d2,
TABLE_GROUP d3
WHERE
DOMAIN = p_domain_id AND
b.DOMAIN_ID = a.DOMAIN AND
c1.ID = a.DE_TYPE AND
c2.ID = a.VALUE_CLASS AND
d1.TABLE_ID = a.DATA_TABLE_ID AND -- it works well without the next two lines
d2.TABLE_ID = a.VALUE_TABLE_ID "(+)" AND
d3.TABLE_ID = a.PARAM_TABLE_ID "(+)"
ORDER BY a.NAME;
Edited by: user10817976 on Oct 19, 2009 8:14 AMOne of my standard replies...
Oracle syntax does not support outer joining to more than one table.
However ANSI syntax does...
SQL> select * from a;
ID B_KEY C_KEY
1 2 3
2 1 4
3 3 1
4 4 2
SQL> select * from b;
ID C_KEY2
1 1
2 5
3 3
4 2
SQL> select * from c;
KEY1 KEY2 DTA
1 1 1-1
1 2 1-2
1 3 1-3
1 4 1-4
2 1 2-1
2 2 2-2
2 3 2-3
2 4 2-4
3 1 3-1
3 2 3-2
3 3 3-3
3 4 3-4
4 1 4-1
4 2 4-2
4 3 4-3
4 4 4-4
16 rows selected.
SQL> ed
Wrote file afiedt.buf
1 select a.id as a_id, b.id as b_id, c.key1 as c_key1, c.key2 as c_key3, c.dta
2 from a, b, c
3 where a.b_key = b.id
4 and a.c_key = c.key1 (+)
5* and b.c_key2 = c.key2 (+)
SQL> /
and a.c_key = c.key1 (+)
ERROR at line 4:
ORA-01417: a table may be outer joined to at most one other table
SQL> ed
Wrote file afiedt.buf
1 select a.id as a_id, b.id as b_id, c.key1 as c_key1, c.key2 as c_key3, c.dta
2 from a JOIN b ON (a.b_key = b.id)
3* LEFT OUTER JOIN c ON (a.c_key = c.key1 and b.c_key2 = c.key2)
SQL> /
A_ID B_ID C_KEY1 C_KEY3 DTA
3 3 1 3 1-3
4 4 2 2 2-2
2 1 4 1 4-1
1 2
SQL> -
ORA-01417: a table may be outer joined to at most one other table
Hi All,
I want to display the data even if there is no corresposding data in the fac_pos table.
when using outer joins getting error message.
Any work around for this ? Please suggest. :-)
SQL> SELECT case when flen.FPID is not null then
2 'do the calculations here'
3 else
4 'no value in the FAC_POS table so do the ELSE PART'
5 end CASE ,
6 mtf.EXT_FID
7 FROM
8 D_F_MAP MTF,
9 FAC EFAC,
10 TRADING EST,
11 FAC_POS FLEN,
12 USERS_MAP custmap
13 WHERE mtf.SRC_FID = efac.FID (+)
14 AND mtf.SRC_DID = efac.DID (+)
15 AND efac.TFID = est.TFID
16 AND mtf.EXT_FID (+) = flen.FID
17 AND mtf.EXT_DID (+) = flen.DID
18 AND custmap.SRC_CUST_ID = est.SID (+)
19 AND custmap.EXT_CUST_ID = flen.CUSTID (+)
20 and est.TFID =14;
no rows selected
SQL> SELECT case when flen.FPID is not null then
2 'do the calculations here'
3 else
4 'no value in the FAC_POS table so do the ELSE PART'
5 end CASE ,
6 flen.CUSTID FROM TRADING EST, USERS_MAP,FAC_POS FLEN,FAC EFAC, D_F_MAP MTF
7 WHERE
8 EST.SID = USERS_MAP.SRC_CUST_ID (+) AND
9 USERS_MAP.EXT_CUST_ID = flen.CUSTID (+) AND
10 MTF.SRC_DID (+) = EFAC.DID AND
11 MTF.SRC_FID (+) = EFAC.FID AND
12 efac.TFID = est.TFID AND
13 mtf.EXT_FID (+) = flen.FID AND
14 mtf.EXT_DID (+) = flen.DID AND
15 est.TFID =14
16 /
MTF.SRC_FID (+) = EFAC.FID AND
ERROR at line 11:
ORA-01417: a table may be outer joined to at most one other table
create table D_F_MAP
SOURCE VARCHAR2(10) not null,
SRC_DID VARCHAR2(8) not null,
SRC_FID VARCHAR2(10) not null,
EXT_DID VARCHAR2(20),
EXT_FID VARCHAR2(20)
create table FAC
TFID NUMBER,
SRC VARCHAR2(10),
DID NUMBER,
FID NUMBER,
CSAMT NUMBER
create table FAC_POS
FPID NUMBER,
CUSTID NUMBER,
SRC VARCHAR2(10),
DID NUMBER,
FID NUMBER,
SPOS NUMBER
create table PASS_OVER
TFID VARCHAR2(20) not null,
FLG VARCHAR2(1)
create table TRADING
TFID NUMBER not null,
SRC VARCHAR2(10),
TDATE DATE,
BID NUMBER,
SID NUMBER
create table USERS_MAP
SRC_CUST_ID VARCHAR2(8) not null,
EXT_CUST_ID VARCHAR2(20),
SRC VARCHAR2(10) not null
insert into D_F_MAP (SOURCE, SRC_DID, SRC_FID, EXT_DID, EXT_FID)
values ('KP', '854', '7754', '101', '1202');
insert into D_F_MAP (SOURCE, SRC_DID, SRC_FID, EXT_DID, EXT_FID)
values ('KP', '4545', '4444', '504', '1604');
insert into D_F_MAP (SOURCE, SRC_DID, SRC_FID, EXT_DID, EXT_FID)
values ('KP', '7858', '9646', '604', '1705');
insert into D_F_MAP (SOURCE, SRC_DID, SRC_FID, EXT_DID, EXT_FID)
values ('MS', '8799', '4544', '987', '1654');
insert into FAC (TFID, SRC, DID, FID, CSAMT)
values (10, 'KP', 854, 7754, 85000);
insert into FAC (TFID, SRC, DID, FID, CSAMT)
values (11, 'KP', 854, 7754, 44000);
insert into FAC (TFID, SRC, DID, FID, CSAMT)
values (12, 'KP', 4545, 4444, 47000);
insert into FAC (TFID, SRC, DID, FID, CSAMT)
values (13, 'KP', 7858, 9646, 80000);
insert into FAC (TFID, SRC, DID, FID, CSAMT)
values (14, 'MS', 8799, 4544, 60000);
insert into FAC (TFID, SRC, DID, FID, CSAMT)
values (15, 'KP', 854, 7754, 66000);
insert into FAC_POS (FPID, CUSTID, SRC, DID, FID, SPOS)
values (94, 5555, 'EXT', 504, 1604, 6000);
insert into FAC_POS (FPID, CUSTID, SRC, DID, FID, SPOS)
values (90, 1111, 'EXT', 101, 1202, 1000);
insert into FAC_POS (FPID, CUSTID, SRC, DID, FID, SPOS)
values (91, 2222, 'EXT', 302, 3652, 1000);
insert into FAC_POS (FPID, CUSTID, SRC, DID, FID, SPOS)
values (92, 3333, 'EXT', 987, 1654, 6000);
insert into FAC_POS (FPID, CUSTID, SRC, DID, FID, SPOS)
values (93, 4444, 'EXT', 604, 1705, 9000);
insert into TRADING (TFID, SRC, TDATE, BID, SID)
values (10, 'KP', to_date('10-02-2009', 'dd-mm-yyyy'), 1548, 96751);
insert into TRADING (TFID, SRC, TDATE, BID, SID)
values (11, 'KP', to_date('02-02-2009', 'dd-mm-yyyy'), 5468, 7895);
insert into TRADING (TFID, SRC, TDATE, BID, SID)
values (12, 'KP', to_date('20-02-2009', 'dd-mm-yyyy'), 1258, 6985);
insert into TRADING (TFID, SRC, TDATE, BID, SID)
values (13, 'KP', to_date('22-02-2009', 'dd-mm-yyyy'), 5468, 7865);
insert into TRADING (TFID, SRC, TDATE, BID, SID)
values (14, 'MS', to_date('18-02-2009', 'dd-mm-yyyy'), 4669, 6893);
insert into TRADING (TFID, SRC, TDATE, BID, SID)
values (15, 'KP', to_date('20-02-2009', 'dd-mm-yyyy'), 1548, 6975);
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('9675', '1111', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('5468', '2222', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('6893', '3333', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('5468', '4444', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('7865', '5555', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('6975', '6666', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('6975', '7777', 'kp');
insert into USERS_MAP (SRC_CUST_ID, EXT_CUST_ID, SRC)
values ('6985', '8888', 'kp');Thanks.Hi,
Thanks for posting the sample data in such a useful form! I'm sorry, I'm not at a database now, so I can't run it.
What are the correct results you want from that data?
You can outer-join to more than one table using ANSI notation.
Another solution is to do some of the joins in a sub-query. It looks like the problem is with the est table. If you join all the tables except est in a sub-query, then you can join est to that result set in the main query.
If you "want to display the data even if there is no corresponding data in the fac_pos table.", and fac_pos is being called flen, then you have the + signs in the wrong places.
16 AND mtf.EXT_FID (+) = flen.FID
17 AND mtf.EXT_DID (+) = flen.DID means "display data from flen even if there is no match in mtf". -
Hi all, I have the following query
select a.incident_id,incident_number, d.source_object_id, a.incident_status_id, d.TASK_ID TASK_ID ,jta.task_id assign_task_id, d.source_object_type_code, a.owner_group_id, a.customer_id,jta.resource_type_code, jta.resource_id
FROM cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c, jtf.jtf_tasks_b d, jtf_task_assignments jta, jtf_rs_groups_vl jrg
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND c.language = 'EL'
AND b.incident_status_id = 1
AND a.owner_group_id IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.get_lov_group_id('ΣΥΖΕΥΞΙΣ-ΒΛΑΒΟΔΙΑΧΕΙΡΙΣΤΕΣ') AS xxi_group_id_tab)))
AND a.customer_id IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.get_party_id('ΣΥΖΕΥΞΙΣ-ΒΛΑΒΟΔΙΑΧΕΙΡΙΣΤΕΣ','ΚΤΠ ΦΟΡΕΙΣ') AS xxi_party_id_tab)))
AND a.incident_id = d.source_object_id (+)
AND d.source_object_id IS NULL
AND d.task_id = jta.task_id (+)
AND jta.resource_type_code IS NULL
AND jrg.group_id = jta.resource_id (+)
order by incident_number
As you see I need to find a workaround to replace the second outer join, otherwise I get the error : ORA-01417: a table may be outer joined to at most one other table
Any suggestion will be appreciated...
AlexHi,
I am also stuck in the same issue of ORA-01417. Can some body help with me in this? Thanks a lot.
SELECT
wi.bill_catgry_id
, i.item_code
, i.item_key
, w.ord_num
, i.pack
, i.item_size
, i.size_code
, country_num
, i.tag_descr
, decode(pc_inline.PICK_QTY,'',p.PICK_QTY,pc_inline.pick_qty) pick_qty
, UPPER(b.descr)
, DECODE(:facility_num,3,id.dept_num,0) dept
FROM pick p, item i, bill_catgry b, route r, work_ord w, whse_item wi,
item_dept id
, (select ord_num, item_key, country_num, sum(pick_qty) pick_qty
from pick_country
group by ord_num, item_key, country_num) pc_inline
, country c
WHERE
1=1
AND w.ord_num=p.ord_num
AND w.ship_date = TO_DATE(:ship_date,'DD-MON-RR')
AND p.item_key = i.item_key
AND p.item_key = wi.item_key
AND p.item_key = id.item_key
AND wi.item_key = id.item_key
AND w.store_num = :store_num
AND w.route_id = :route_id
AND w.route_id = r.route_id
AND w.work_type in ('R','S')
AND wi.bill_catgry_id=b.bill_catgry_id
AND r.whse_num = :whse_num
AND w.ord_num = pc_inline.ord_num(+)
AND i.item_key = pc_inline.item_key(+)
AND pc_inline.COUNTRY_NUM = c.country_num(+)
Any help is really appreciated.
Thanks
Yogesh. -
Universe连接Oracle DB遇到ORA-01417 error
Hi,
我用Universe连接Oracle DB, 在universe 中join 了一些表,并且有几张表之间用了left outer join. 然后把Universe Export 到BOE上, 用Crystal Report连接这个universe, 在运行的时候得到下面这个error:
"A database error occured. The database error text is ORA-01417: a table may be outer joined to at most one other table. (WIS 10901)"
请教有没有遇到同样问题的,怎么解决的啊? 急。。。 谢谢!一张表是不能同时和两张或两张以上的表进行外连接的
你可以这样写
a.id=b.id() and a.name=c.name()
但是你不能这样写
a.id()=b.id and a.name()=c.name
虽然这两种写法的结果是不一样的,但是你的问题就是这个。
你可以去universe看一下,你的left outer join肯定有这样的情况存在。 -
Translating SQL from MYSQL to ORACLE with more than one outer join.
I will translate the following sqlquery from MYSQL to ORACLE:
SELECT ticket.ticket_no,ticket.ticket_dato,ticket.ticket_subject,ticket.customer_id,customer_name,ticket.ticket_own_read, ticket.department_id, department.department_name, priority_name, tickstat_name, tickettype_name
FROM customer, ticket left join department
on ticket.department_id = department.department_id left join priority on ticket.priority_id = priority.priority_id
left join ticketstatus on ticket.tickstat_id = ticketstatus.tickstat_id
left join tickettype on ticket.tickettype_id = tickettype.tickettype_id
where ticket.customer_id = customer.customer_id and customer.owner_id =
#session.owner_id#
I have tried in ORACLE with:
SELECT ticket.ticket_no,ticket.ticket_dato,ticket.ticket_subject,ticket.customer_id,customer_name,ticket.ticket_own_read, ticket.department_id, department.department_name, priority_name, tickstat_name, tickettype_name
FROM customer, ticket ,department, priority, ticketstatus, tickettype
where
ticket.department_id(+) = department.department_id and
ticket.priority_id(+) = priority.priority_id and
ticket.tickstat_id(+) = ticketstatus.tickstat_id and
ticket.tickettype_id(+) = tickettype.tickettype_id and
ticket.customer_id = customer.customer_id and customer.owner_id = #session.owner_id#
I get an error:
MERANT][ODBC Oracle driver][Oracle]ORA-01417: a table may be outer joined to at most one other table
How do I translate the code to ORACLE?I think that your syntax is wrong. The (+) operator should be on the right hand table column, not the left hand table column if you want all rows on the left hand table column. If this syntax is really what you want, you can create underlying views for each join condiction.
-
How to use outer join on 2 tables with Oracle 8i
Could anyone tell me the Oracle 8i syntax equivalent to :
select user.name, city.adress, contry.name
from user
left outer join city on (user.rCity = city.code)
left outer join country on (user.rCountry = country.code)
I tried following :
select user.name, city.adress, contry.name
from user, city, contry
where user.rCity (+) = city.code
and user.rCountry (+) = country.code
but displayed following error :
ORA-01417: a table may be outer joined to at most one other table
Thank youLogically I would expect a user to have a city and a country, or not. In that case the outer join should be on the other tables. Making your query:
select user.name, city.adress, country.name
from user, city, country
where user.rCity = city.code (+)
and user.rCountry = country.code (+); -
Joining multiple tables in Oracle DB
I have the following tables.
1. AddProject
- projID
- projName
2. AddLab
- labID
- labName
3. ProjLabAssociation
- projID
- labID
4. AddResearchArea
- raID
- raName
5. ProjRAAssociation
- projID
- raID
AddProject is associated with both the tables-AddLab and AddResearchArea
ProjLabAssociation and ProjRAAssociation are association tables which contain the primary keys from corresponding tables. Both the fields in these 2 tables are primary keys.
If AddProject has 3 entries - (Proj1,ProjectA),(Proj2,ProjectB),(Proj3,ProjectC)
AddLab has 2 entries - (Lab1,Bangalore),(Lab2,Chennai)
AddResearchArea has 2 entries - (RA1,Green Computing),(RA2,Cloud Computing)
ProjLabAssociation has 2 entries - (Proj2,Lab1),(Proj3,Lab1)
ProjRAAssociation has 3 entries - (Proj2,RA1),(Proj3,RA1),(Proj3,RA2)
If I am querying by AddLab data for (Lab1,Bangalore), I should be getting the following columns in the result table
Table2ID | Table2Name | Table3ID | Table3Name | Table1ID | Table1Name
Lab1 | Bangalore | RA1 | Green Computing | Proj2 | ProjectB
Lab1 | Bangalore | RA1 | Green Computing | Proj3 | ProjectC
Lab1 | Bangalore | RA2 | Cloud Computing | Proj3 | ProjectC
I have been trying the following commands but I m getting the expected result
1.SELECT * FROM AddLab al, ProjLabAssociation pl, AddProject ap WHERE al.labID = pl.labID(+) and ap.projID = pl.projID(+);An SQLException is thrown saying - java.sql.SQLException: ORA-01417: a table may be outer joined to at most one other table
2.SELECT * FROM AddLab,AddProject,AddResearchArea WHERE labID in
(select al.labID from ProjLabAssociation pl,AddLab al where al.labID = pl.labID)
AND projID in
(select ap.projID from ProjLabAssociation pl,Addproject ap where ap.projID = pl.projID)
AND themeID in
(select ar.raID from ProjRAAssociation pr, AddResearchArea ar where ar.raID = pr.raID)
AND projID in
(select ap.projID from ProjRAAssociation pr,Addproject ap where ap.projID = pr.projID)
ORDER BY labID;I am not getting the expcted results here
Oracle version : 9i 10g/11g
Can anyone help me in this.
Edited by: user9205634 on Dec 22, 2011 3:40 AM1. Always tell the community your Oracle version
2. If you want to learn, always show to the community you tries so far
3. Always use tags before and after your code to keep the code formatted on forum side
4. Post in the proper forum according to the question, in yuour case, <a href=PL/SQL & PL/SQL</a> (not Database General)
+=> thread moved there.+
Nicolas. -
How to use multiple outer join in ODI
SELECT
Count(*)
FROM
student S,
department D,
course C
WHERE
D.S_Name=S.S_Name
AND D.Dept_Name = C.Dept_Name (+)
and S.C_Name =C.C_Name (+)
And (D.Dept_ID = 1);
I run this query. I got an ORA-01417 error.In topology change the join option to Ordered ISO
then rewrite your query with ANSI syntax.
SELECT
Count(*)
FROM
student S join department D on D.S_Name=S.S_Name,
student S right outer join course C on S.C_Name =C.C_Name,
department D right outer join course C on S.C_Name =C.C_Name
where
(D.Dept_ID = 1);
First verify the code in sql client befor implementing it in ODI
Thanks,
Sutirtha -
ANSI SQL 92 SYNTAX OUTER JOIN PERFORMANCE ISSUE
Good Morning
Could anyone explain why the excution time for these two (ment to be identical)
queries run so differently.
oracle syntax execution time 1.06 seconds
select COUNT(*) from
PL_EVENT_VIEW pev,
PL_EVENT_STAFF_VIEW pesv
WHERE pev.EVENT_ID=PESV.EVENT_ID(+)
AND pev.WEEKS=PESV.WEEK_NUM(+)
AND pev.event_id=2520
ansi sql 92 syntax execution time 7.05 seconds
select COUNT(*) from
PL_EVENT_VIEW pev
LEFT JOIN PL_EVENT_STAFF_VIEW pesv
ON (pev.EVENT_ID=PESV.EVENT_ID
AND pev.WEEKS=PESV.WEEK_NUM)
WHERE pev.event_id=2520
Thanks
David HillsBTW Oracle outer join operator (+) and ANSI SQL OUTER JOIN syntax are NOT equivalent. Consider following:
DROP TABLE T1;
CREATE TABLE T1 (C1 NUMBER);
DROP TABLE T2;
CREATE TABLE T2 (C2 NUMBER);
DROP TABLE T3;
CREATE TABLE T3 (C3 NUMBER);
-- Following SELECT works:
SELECT COUNT(*)
FROM T1, T2, T3
WHERE C2 = C1
AND C3(+) = C1
COUNT(*)
0
-- But:
SELECT COUNT(*)
FROM T1, T2, T3
WHERE C2 = C1
AND C3(+) = C1
AND C3(+) = C2
AND C3(+) = C1
ERROR at line 4:
ORA-01417: a table may be outer joined to at most one other table
-- However with ANSI syntax:
SELECT COUNT(*)
FROM T1
JOIN T2 ON (C2 = C1)
LEFT JOIN T3 ON (C3 = C1 AND C3 = C2)
COUNT(*)
0 -
Oracle outer join on multiple tables throws error
Hi ,
We are using ansi joins with outer joins on multiple tables in oracle 9i.
Now these queries have to be used in Oracle8i.
Since Oracle8i does not support ansi sql we are replacing the ansi sql queries with the oracle joins.
On trying the same we found that the following query
select *from tab1 a, tab2 b, tab3 c where a.c1 = b.col1(+) and c.c2 = b.col2 (+)
throws the error
ORA-01417: a table may be outer joined to at most one other table.
Is there a way to simulate this query without using the outer joins on multiple tables?
thanksTry writing the query in this form:
select * from
(select t1.col1, t1.col2
from schema.table1 t1, schema.table2 t2
where t1.col1 = t2.col1(+)) t4,
schema.table3 t3 where t4.col2 = t3.col2(+)
In the subquery, you will have to list all the columns you want to see, and you will need to provide unique aliases for any columns with duplicate names. I tested this on 9i, and don't have an 8i system to work with, so I hope this helps. -
How i can apply ANSI standared in i.e LEFT OUTER JOIN because in the query given below it's showing error
SELECT NVL(uiq.question,ucq.question) as question,
iqa.answer as answer,
iqa.seperate_cover as reference_attached,
iqa.attachment_extension as file_extension,
iqa.filename as filename,
addr.address_1 as attachment_address_1,
addr.address_2 as attachment_address_2,
addr.address_3 as attachment_address_3,
addr.address_4 as attachment_address_4,
addr.postcode as attachment_postcode,
cty.description as attachment_country,
iqa.upt_iqa_id as questionanswer.id
FROM upt_iqa_questions_answers iqa,
tpz_add_address addr,
trf_cty_country cty,
ukp_uiq_ins_question uiq,
ukp_ucq_uic_question ucq
WHERE iqa.upt_iap_id = <parameter primary key application>
AND addr.tpz_add_id = iqa.tpz_add_id (+)
AND cty.trf_cty_id = addr.trf_cty_id (+)
AND uiq.ukp_uiq_id = iqa.ukp_uiq_id (+)
AND ucq.ukp_ucq_id = iqa.ukp_ucq_id (+)
ORDER BY iqa.position;Hello,
I suppose that error message is ORA-01417 : a table may be outer joined to AT MOST ONE other table ?
In this case, it means that you can not outer join iqa to addr, uiq and ucq.
What is the meaning of your tables, and what data would you like to select ? -
Need clarification on ANSI Joins
Hi All,
I need some clarification on the ANSI Join which I build to avoid an error when I am trying to execute the same in regular join.
With Regular join I am getting the error ORA-01417: a table may be outer joined to at most one other table.
Regular Join Condition:
select null
FROM
land_event_device_fraud T1, --Update Dealer
land_event_device_upgrade T2, --New Subscriber First Set
syn_intg_event_device_state T3, --Existing Subscriber
land_event_device_upgrade T4 --New Subscriber Second Set
WHERE T1.event_id = T2.event_id(+) AND T1.rate_plan_id = T2.rate_plan_id(+)
AND T1.event_id = T3.event_id(+) AND T1.rate_plan_id = T3.rate_plan_id(+)
AND T4.event_id = T1.event_id(+) AND T4.event_id = T1.rate_plan_id(+)
AND T4.event_id = T3.event_id(+) AND T4.event_id = T3.rate_plan_id(+);
--Getting error ORA-01417.
Replaced the above join with ANSI Join
SELECT NULL
FROM land_event_device_fraud t1
LEFT OUTER JOIN land_event_device_upgrade t2
ON (t1.event_id = t2.event_id AND t1.rate_plan_id = t2.rate_plan_id)
LEFT OUTER JOIN syn_intg_event_device_state t3
ON (t1.event_id = t3.event_id AND t1.rate_plan_id = t3.rate_plan_id),
land_event_device_upgrade t4
LEFT OUTER JOIN land_event_device_fraud t5
ON (t4.event_id = t5.event_id AND t4.rate_plan_id = t5.rate_plan_id)
LEFT OUTER JOIN syn_intg_event_device_state t6
ON (t4.event_id = t6.event_id AND t4.rate_plan_id = t6.rate_plan_id);
I want to know whether the ANSI Join is goig to work fine or it is going to give me any cartesian production information.
Appreciate your help here.
Thanks,
MK.Hi,
Maddy wrote:
Hi All,
I need some clarification on the ANSI Join which I build to avoid an error when I am trying to execute the same in regular join.
With Regular join I am getting the error ORA-01417: a table may be outer joined to at most one other table.
Regular Join Condition:
select null
FROM
land_event_device_fraud T1, --Update Dealer
land_event_device_upgrade T2, --New Subscriber First Set
syn_intg_event_device_state T3, --Existing Subscriber
land_event_device_upgrade T4 --New Subscriber Second Set
WHERE T1.event_id = T2.event_id(+) AND T1.rate_plan_id = T2.rate_plan_id(+)
AND T1.event_id = T3.event_id(+) AND T1.rate_plan_id = T3.rate_plan_id(+)
AND T4.event_id = T1.event_id(+) AND T4.event_id = T1.rate_plan_id(+)
AND T4.event_id = T3.event_id(+) AND T4.event_id = T3.rate_plan_id(+);
--Getting error ORA-01417.
Replaced the above join with ANSI Join
SELECT NULL
FROM land_event_device_fraud t1
LEFT OUTER JOIN land_event_device_upgrade t2
ON (t1.event_id = t2.event_id AND t1.rate_plan_id = t2.rate_plan_id)
LEFT OUTER JOIN syn_intg_event_device_state t3
ON (t1.event_id = t3.event_id AND t1.rate_plan_id = t3.rate_plan_id),
land_event_device_upgrade t4
LEFT OUTER JOIN land_event_device_fraud t5
ON (t4.event_id = t5.event_id AND t4.rate_plan_id = t5.rate_plan_id)
LEFT OUTER JOIN syn_intg_event_device_state t6
ON (t4.event_id = t6.event_id AND t4.rate_plan_id = t6.rate_plan_id);You're mixing ANSI joins and old joins. That's very confusing. Use all of one kind or all of the other.
>
I want to know whether the ANSI Join is goig to work fine or it is going to give me any cartesian production information.What happens when you try it? Does it produce the results you want?
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. Explain how you get those results from that data.
Always say which version of oracle you're using.
See the forum FAQ {message:id=9360002}
Why does the SELECT clause include only NULL? Is this going to be used as an EXISTS sub-query? If so, why bother to do outer joins, and why do you care if it does a Cartesian product? What is the compete query?
For debugging purposes, you might want to include something that you can see in the SELECT clause. -
Hi all,
I've several reference data tables and one of them is composed from several IDs from the others. To get data from this table i've to make a Lookup to the other tables and with the values from this lookups make a final lookup to this last table.
When i try to do this in a mapping, i've got the error "ORA-01417: a table may be outer joined to at most one other table" (I've no warning or error when composing or deploying the mapping), when i look to the script generated it really makes outer joins to all of the lookup tables i need.
I've tried several other solutions: several joins between each table (that previously represented the lookups); one single join. But nothing works, i always get the same error. (this joins should represent a single table!? No?)
Is this possible to be done? I've worked with several others ETL tools that was easy to do this.
I'm working with:
OWB 9.2
Oracle database 9.2
Thanks,
VitorPartial Solution... (not completely satisfied)
If i use an aggregator or a deduplicator before last lookup it works fine, but if i don't want to deduplicate the results!?
Thanks,
Vitor -
Forcing joins to be done separately
Is there a way to prevent OWB from combining joins when generating mappings? We have a case were we need to join two tables together and then do an outer join on that result to a third table.
select join.col1, join.col2, c.col3
from (select a.col1, b.col2
from table1 a, table2 b
where a.col1=b.col1) join,
table3 c
where join.col1=c.col1(+)
and join.col2=c.col2(+)
Unforuntately, after creating the mapping using two join operators the SQL generated looks like this ...
select a.col1, b.col2, c.col3
from table1 a, table2 b, table3 c
where a.col1=c.col1(+)
and b.col2=c.col2(+)
As a result, we get this error during execution: "ORA-01417: a table may be outer joined to at most one other table"Hi,
I had a similar problem with lookups:
Problem with lookups and outer joins
There are two workarounds for your problem that I'm aware of:
1) Insert a sort (or aggregator) between the two joins. This does unfortunately have a performance impact
2) Create a view to resolve one of the two joins. No performance impact, but not very elegant as you have to move "ETL logic" from the model (mapping) down into the database.
Question for development; Is there a reason why separate joins are not always resolved as inline views?
Roald
Maybe you are looking for
-
Itunes update will not install help - read details - help
it will start updating like normal but when it starts to install the following messege comes up - "the feature that you are trying to use is on a network resource that is not available click OK to try again, or enter an alternative path to a folder c
-
i have embed the pdf in html page and displaying popup over the pdf but its going behind in IE and works fine in chrome and firefox.( ihave used all css properties like z-index and different jquery popup and plugins but it not worked in IE).
-
How to single sign on with webApplication with Basic Authenticated in IIS
Dear Sir, Our server is EP6 SP14, we will link iview with BW URL which using basic authen in IIS. . Please kindly advise howto single sign on with webApplication with Basic Authenticated in IIS Thank you and best regards, Vimol
-
Using an original iPhone with 2.0 update. Question about programs that request using location services....when these programs are running in the background, do they use these services, or just when they are open and on screen? I'd like to just leave
-
On start up i get an eror massage product infomation is not valid
on start up my HP 2000 notebook 2106-TU i get an error massage product information is not valid & also get some error like this type error like as product configuration i s not vaid, product name , product no. is not valid please give me suggestion