A table may be outer joined to at most one other table
I am trying to use a lookup dim (C) with inputs from 2 different lookup dim (A and B). And I getting the following error:
"a table may be outer joined to at most one other table"
Any suggestion?
This is sql limitation that you can not have queries like
select ...
from a, b, c
where c.x1(+) = a.y
and c.x2(+) = b.z
Probaby you are genearting code similar to this. I will suggest to use Joiner instead of lookup as you have better control over join conditions there. Other option may be to use Transformation function.
Similar Messages
-
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". -
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> -
Oracle OUTER JOIN on more than one table
Hi!
Friends, please help with this urgent problem: How can an outer join be written on more than one table?
An SQL Server query:
SELECT * from a INNER JOIN b on a.id = b.id LEFT OUTER JOIN c ON c.id = a.id AND c.id = b.id
works fine with SQL SERVER
But Oracle query:
SELECT * from a,b,c WHERE a.id = b.id AND a.id = c.id (+) AND b.id = c.id (+)
gives an error: OUTER JOIN cannot be used on more than one table? Why?
I use OracleDriver from classes12.zip to connect to Oracle8i database.
Please, help!The Oracle 8i and later SQL reference reads that the following "join_types" are supported and under this syntax it does not limit the LEFT OUTER JOIN (syntax the same as SQLServer example in original note) to two tables as implied in these notes:
The join_type indicates the kind of join being performed:
Specify INNER to indicate explicitly that an inner join is being performed. This is the default.
Specify RIGHT to indicate a right outer join.
Specify LEFT to indicate a left outer join.
Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls.
You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed. -
How to use left outer join on more than one table (source)
Hi all,
In our project we are converting the Unix shell & SQL scripts into OWB mappings. We are facing problem converting left outer join in OWB. here is one of the example. i have just pasted the FROM and where condition.
FROM ym_scr t1, branch_finmonth t3
LEFT OUTER JOIN item_image t2
ON (t1.branch_no = t2.branch_no
AND t1.item_no = t2.item_no
AND t3.to_date between t2.tran_dt and t2.to_dt
AND t2.to_dt >= '$start_images' ) <<<========= '$start_images' THIS COMES FROM THE UNIX VARAIBLE ,
We converts the same when we are putting it in OWB join Operator
INGRP1.branch_no = INGRP2.branch_no(+)
AND INGRP1.item_no = INGRP2.item_no(+)
AND INGRP3.to_date between t2.tran_dt and t2.to_dt
AND INGRP2.to_dt >= INGRP2.start_images
But as you see in the OWB opreator we can put left join with INGRP1 with INGRP2.
We can not make same join with INGRP3 & INGRP4 , becoz it failed saying "you cannot left outer join on more than one table/source".
so overall this OWB code makes incomplete left outer join as per the above ANSI SQL join in Oracle.
Bcoz of the problem we are getting less number of rows...........
SO please please help me on this
Regards
AshokHi.
I know this topic is here for a while now, but I had the same problem today, searched for help and didn´t find anything.
Later I figured out how to do this.
You just have to put the (+) one time, and the OWB converts in an LEFT OUTER JOIN statement.
For this case, all you have to do is:
( INGRP1.branch_no = INGRP2.branch_no(+) AND INGRP1.item_no = INGRP2.item_no AND INGRP2.to_dt >= INGRP2.start_images )
Regards,
Godoy -
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 (+); -
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. -
Left Outer Joining multiple tables to one source table FAILS with VLD-1511
Hi all,
Is it me, or is OWB unable to handle left outer joining 1 source table to multiple other tables?
I want to load a fact table so I have 1 source table with measures. This table must be outer joined to some dimensions that have their FK in the fact table.
The SQL statement would look like this (and is perfectly valid):
select ...
from input, dim1, dim2
where input.c1 = dim1.c1(+)
and input.c2 = dim2.c2(+);
I put the where clause in the joiner operator and validate, but that gives me message VLD-1511: A table may be outer joined to at most one other table.
Even splitting this up into one outer join per joiner still gives this message.
A search and look around on the forum and on metalink shows there are related issues (like bug 3334035). Seemingly creating a view is the work-around to use.....? (ie downgrading owb to a simple gui tool) }-;
Have other people experienced this problem of not being able to outer join one input table to multiple other tables?
Thanks,
EdI have had some feedback from Oracle. It turns out this has to do with 2 issues. Below I have pasted the text that Support gave me:
<---------- START QUOTE ---------->
RESEARCH
=========
Bug 3437036 KEY LOOKUP DOES NOT DETECT ORA-1417 IN VALIDATE/GENERATE STEP
Unpublished Bug 4211684 FORWARD PORT OF BUG 3437036
shows:
Some more development has been completed when this bug is fixed in Paris.
The following are the details:
1. If the join condition contains a full outer join such as
tab1.c (+) = tab2.c (+) and tab2.c (+) = tab3.c
then the new validations implemented for this bug do not apply since
in OWB, full outer join triggers generation of joins in ANSI syntax.
ANSI syntax does not have the original problem the base bug of this
bug reported.
2. If the join condition does not contain any full outer join condition,
then the join is generated in Oracle join syntax, which is subject two
several restrictions. The fix to this bug check two of the restrictions.
3. The first restriction in Oracle syntax is that the outer join operator
"(+)" can only directly be attached to a column name. If you attach it
to an expression, such as the following:
(tab1.c + 1) (+) = tab2.c
Then there will be an ORA-936 error at the time of mapping deployment.
For this case, I have added a validation message VLD-1512 to error out
this situation.
4. The second restriction in Oracle syntax is that a table can only be
outer joined to exactly one other table.
For example, this is an invalid join in Oracle syntax:
tab1.c (+) = tab2.c and tab1.d (+) = tab3.d
because tab1 is left outer joined to tab2 and tab3.
But note that the following is still valid in Oracle syntax:
tab1.c (+) = tab2.c and tab1.d = tab3.d (+)
because tab1 is left outer joined to tab2 and right outer joined to tab3.
So this latter case does not violate the restriction that "same oj" to
more than 1 table is not allowed.
If same oj to more than 1 table is specified in a join condition,
VLD-1511 will be issued, and the map is made invalid.
<---------- END QUOTE ---------->
OWB does a partial validation, ie not all access paths are (can be) checked. A full check is only done by the database itself. So some scenarios (like checking whether multiple tables are outer joined the correct way) are not checked, and in this case are flagged with an error (even though it is actually a correct scenario).
Seemingly this was not flagged with an error in earlier versions of OWB, so beware, OWB behaviour may change when upgrading...
Alternative solutions are (1) using key lookups, (2) using a view with all outer joins in there, (3) using intermediate result tables between the joins.
Hope this info helps some people prevent spending too much time on a false error message,
Ed -
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.
-
Oracle 8i -multiple LEFT OUTER JOIN
Hi,
I have to convert some stored procedure from Sql Server to Oracle 8i where I have multiple LEFT OUTER JOIN on a table. Because Oracle 8i accept only one outer join on a table how can I convert this:
select a.id, b.id
from test as a LEFT JOIN test1 b ON a.id(+)=b.id
and a.display(+)=b.display
and a.name(+)='Done';
Thanks.FROM test a LEFT JOIN test1 b ON b.key = a.keyis equivalent to
FROM test a, test1 b WHERE b.key(+) = a.keyThere is a restriction (when using the "(+)" syntax) that a table may be outer-joined to at most one other table, but that does not prevent you from having multiple join conditions between those two tables.
From your example I'm not sure whether you need this:
SELECT a.id, b.id
FROM test a
, test1 b
WHERE a.name = 'Done'
AND b.id (+)= a.id
AND b.display (+)= a.display;or this:
SELECT a.id, b.id
FROM test1 b
, test a
WHERE a.id (+)= b.id
AND a.display (+)= b.display;
WHERE a.name (+)= 'Done'; -
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 -
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 ? -
Good Morning everyone,
Technically, we are in Spring but I have a following snow storm.
ORA-01417: a table may be outer joined to at most one other table
Any help!
Thanks,
NYHi,
~NYorker wrote:
I would like to know about and reason to use left joined.
What is ANSI format?ANSI join syntax allows you to easily do some things that require complicated sub-queries (if you can do them at all) otherwise. The ORA-01417 error you got is just one of many examples.
Even when it doesn't dramatically reduce the amount of cioding, I find ANSI notation easier to read, understand and debug. Every time you specify a new table in the FROM clause, you have to specify a join condition (or CROSS JOIN); you don;'t have to hunt through a distant WHERE clause to find join conditions.
Look for "join clause+ in the documentation for the SELECT statement:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#i2080416
Any good introductory text for Oracle 9 (or higher) will have a description and examples. -
hi
i have this query
SELECT xoj.entry_date job_date, xoj.well, xoj.rig, xoj.job_type,
xoj.job || xoj.job_type job_descritpion, xoj.opn_job_desc,
lab2.well_depth, fvl.attribute1, xoj.contract, xoj.invoice_date,
xoj.invoice_ref,
SUM (rad.amount) OVER (PARTITION BY xoj.opn_job_desc) invoice_amt,
SUM (npar_get_invoice_balance (ra.customer_trx_id, '31-Aug-2013')
) OVER (PARTITION BY xoj.opn_job_desc) pending_bal_due,
SUM (NVL (app.amount_applied, app.amount_applied_from)
) OVER (PARTITION BY xoj.invoice_ref) amount_paid_correct
FROM xxnp_opn_joblog_001 xoj,
napesco_well_stage_lab lab2,
fnd_flex_values_vl fvl,
ra_customer_trx_all ra,
ra_cust_trx_line_gl_dist_all rad,
ar_receivable_applications_all app,
ar_payment_schedules_all ps_inv,
ar_cash_receipts_all ar
WHERE xoj.opn_job_desc(+) = ra.attribute1
AND rad.customer_trx_id = ra.customer_trx_id
AND xoj.rig(+) = fvl.flex_value --this is the problem : a table cannot be outer joined to more than one
AND xoj.opn_job_id = lab2.job_id
AND xoj.invoice_ref = '2012-1575'
AND rad.account_class = 'REC'
AND rad.latest_rec_flag = 'Y'
AND app.applied_payment_schedule_id = ps_inv.payment_schedule_id
AND app.cash_receipt_id = ar.cash_receipt_id
AND app.display = 'Y'
AND ra.customer_trx_id = ps_inv.customer_trx_idi would like to include AND xoj.rig(+) = fvl.flex_value also in the query
kindly guide
thanking in advance
Edited by: makdutakdu on Apr 8, 2013 1:47 PM
Edited by: makdutakdu on Apr 8, 2013 1:48 PMSir ,i am not able to figure out why
SELECT *
FROM fnd_flex_values_vl fvl, xxnp_opn_joblog_001 xoj
WHERE
xoj.rig = fvl.flex_value
returns no value
whereas xoj.rig(+) =fvl.flex_value does return data ---as this returned data ,i would like to add it in my main query then again datatype of rig is char and flex_value is varchar2 .is tht the problem
and again xoj.rig=fvl.flex_value(+) does not return any datai know everyone in the forum is busy but i am just exploring new areas in oracle at my workplace with the tasks i am given ,which is why i post questions here when i am really stuck or ignorant
kindly guide
thanking in advance
Edited by: makdutakdu on Apr 8, 2013 3:24 PM -
Multiple outer joins from a single table
Here is my scenario - I have 3 folders:
Theater - contains Theater Name and Theater ID
Agency - contains Agency Name and Theater ID
Depot - contains Depot Name and Theater ID
A theater may or may not have an agency. Likewise, it may or may not have a depot.
Thus, I've set up a join from Theater (master) to Agency on Theater ID, and selected "outer join on detail"
Likewise, I've done the same between Theater (master) and Depot on Theater ID
When I attempt to create a report with the columns Theater Name, Agency Name, and Depot Name, I am unable to do so. I can only pick either Agency Name or Depot Name, not both. When I try to add the second outer joined element, Discoverer reports that it cannot determine the join configuration because "more than 1 of the detail folders uses non-aggregate items"
What am I doing wrong? Any help would be greatly appreciated, thanks!Hi,
Try change the joins to be "outer join on detail" and "one to one join relationship between master and detail".
Hope that helps,
Rod West
Maybe you are looking for
-
Is it feasible to set the rows displayed per page dynamically?
Hi, Is it feasible to set the rows displayed per page dynamically in the table view result as per the user wants eg : the user wishes to see only 25 records or all the records? Also what is the maximum limit of rows that can be fetched as per the ent
-
HT1535 The ipad cannot be used the apple mobile service is no started
My ipad will not connect to itunes this error message pops up
-
How to save mail content in IE ?
I can save each mail in Netscape with 'save frame as',but can't save mail in Internet Explorer. Anyone know how to save mail in IE ?
-
Per-thread NI-488.2 globals (ThreadIbsta, ThreadIberr, ThreadIbcnt)
in my application do include Ni488.2 library and program to make gpib call, such as Write("*IDN?"). Then check Ni Spy, there are ThreadIbsta, ThreadIberr and ThreadIbcntl. Is possible to remove these three by any setting?
-
Command-tab does not show minimized window
Hello, use command-tab to cycle through all the open apps, and I stop on one that I want to display. However, if that app is minimized, nothing happens. Not too convenient. Is there a way to automatically show the minimized window when I select it w/