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,
Ed
I 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
Similar Messages
-
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 -
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". -
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. -
LEFT OUTER JOIN multiple tables - using the 9i syntax
I've always written my queries using the (+) operator for outer joins. I want to start using the new ANSI standard available in 9i. I can do it when I'm joining two tables in a simple query, but how does it work when I am joining multiple tables?
Here is an example of some SQL that works with the (+) outer join syntax. How can I convert this to use the LEFT OUTER JOIN syntax?
SELECT *
FROM audit_entry aue,
audit_table aut,
audit_statement aus,
audit_row aur,
audit_row_pkey aup1,
audit_row_pkey aup2
WHERE aue.audit_entry_id = aus.audit_entry_id
AND aut.table_name = 'TEST_AUDITING'
AND aut.table_owner = 'CLA_JOURNAL'
AND aus.audit_table_id = aut.audit_table_id
AND aur.audit_statement_id (+) = aus.audit_statement_id
AND aup1.audit_row_id (+) = aur.audit_row_id
AND aup1.pk_column_name (+) = 'TEST_AUDTING_PK_1'
AND aup2.audit_row_id (+) = aur.audit_row_id
AND aup2.pk_column_name (+) = 'TEST_AUDITING_PK_2'
I can join audit_statement to audit_entry easy enough, but then I want to join audit_table to audit_statement, how do I do that, do I start nesting the join statements?
Thanks
RichardThanks for getting back so quickly, I have tried the suggested SQL with mixed results:
SELECT COUNT(*)
FROM audit_entry aue
JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
WHERE aut.table_name = 'TEST_AUDITING_TWO'
AND aut.table_owner = 'CLA_JOURNAL'
AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
I had to change the order slightly, between the first two JOINs but otherwise it executed OK. My problem is, it should only return 175 rows but its returning 30625 rows. If I comment out the second reference to audit_row_pkey I get the expected result:
SELECT COUNT(*)
FROM audit_entry aue
JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
--RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
WHERE aut.table_name = 'TEST_AUDITING_TWO'
AND aut.table_owner = 'CLA_JOURNAL'
AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
--AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
It looks the same condition is being used in each case but why do I suddenly get so many rows - its joining differently somehow. It must be to do with the order, do I need to bracket the query?
Thanks again
Richard -
I am trying to do left outer join in ODI for the source tables in SQLserver.
I have created a join between 2 columns and made it left outer join by checking the box in join properties.
It is not working as expected. In the query it just does T1.Col1=T2.col1 and makes it as equi join.
Any suggestions?
ThanksI have the same problem..
For example:
Interface:
SOURCE: tbl_employee, tbl_positions
TARGET: tbl_persons
In ANSI SQL it would be:
INSERT INTO tbl_persons (..., position_name)
select ..., tbl_positions.name from tbl_employee left join tbl_positions on tbl_employee.pos_id = tbl_positions.id
But when I execute Interface, inserted data as JOIN, didn't inserted "NULL" in position_name.
"LEFT JOIN" is in Interface's script...
How decide this problem? -
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'; -
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> -
How can I crate a view with tables which require "Left outer join"?
Hi guys,
how can I define a view with tables which require "Left outer join"?. In SE11 "View",->tab "Join condition", it seems that it valid only for "Inner Join".
Please give me some hint.
Thanks in advance.
Regards,
LiyingHi
Inner Join and Outer Join
The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join.
With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view.
With an outer join, records are also selected for which there is no entry in some of the tables used in the view. (ABAP allows left outer join.)
The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. -
Left outer join usage in obiee BMM layer
Hi All,
We lately started using left outer join in our bmm layer , to meet the requirement expectation .
problem : We have two tables Fact A , Dim B . There is an join int_id column to join them . Problem is... in table Dim B , we have 3 millions rows of Int_id and in fact table it is loaded for only data available(1 million rows).
Due to this we are dropping rows in the report ..as it is only getting data where fact.int_id = dim.int_id. So we used left outer join to solve to one particular report .(we know we can do ETl to load dummy int_id and make it null , but it is huge effort ..so we did left outer join)
These days , same kind of reports are in requirement . if i keep on doing same left outer join to meet the requirement in BMM layer ? is there any disadvantages due to this ? any performance degrade due to this ? please throw few lines on left outer join and its usage ?
Thanks,
SriRemodel your tables that might be a partition or any other way and follow in BI as per your new model.
Simply: Go for ETL kind of solution -
Left outer join using multiple table
Hi,
I am trying to use left outer join with multiple tables , the join condition will be based on PERNR and BEGDA & ENDA for each infotype in selection screen.
select pa00~pernr pa00~begda pa00~endda pa00~massn pa00~massg pa00~stat2 pa00~aedtm pa00~uname
pa01~begda pa01~endda pa01~bukrs pa01~persg pa01~persk pa01~mstbr pa01~ename pa01~aedtm pa01~uname
pa02~begda pa02~endda pa02~nachn pa02~vorna pa02~midnm pa02~aedtm pa02~uname
pa016~begda pa016~endda pa016~cttyp pa016~aedtm pa016~uname
into CORRESPONDING FIELDS OF TABLE i_pall
from ( PA0000 as pa00 left OUTER JOIN pa0001 as pa01 on pa00~pernr = pa01~pernr )
left OUTER JOIN pa0002 as pa02 on pa00~pernr eq pa02~pernr )
left OUTER JOIN pa0016 as pa016 on pa00~pernr eq pa016~pernr )
where pa00~pernr in S_pernr
AND pa00~begda in s_bg0000
and pa00~endda in s_nd0000.
but this fails to fetch the value of begda enda from each pa0000,pa0001,pa0002,pa0016.
Please help!
MonirulWhy don't you use the standard logical database PNPCE and then Provide statement?
-
Multiple tables using left outer join?
Hi, guys:
I have 4 tables: A, B, C; if I want to do the following:
A left outer join B, its result left outer join C.
How can I do that? BTW, I am using DB2.
The following is a sample inner join:
select a.id, b.first, c.last
from A as a, B as b, C as c
thanksselect ..
from A a
left outer join B b ON ....
left outer join C c ON ...
WHERE ...
rgds -
Multiple LEFT OUTER JOIN on Oracle 8i
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 c.display(+)=b.display
and c.name(+)='Done';
Thanks.Rewrite as:
select a.id, b.id
from test, test1 b
WHERE a.id(+)=b.id
and a.display(+)=b.display
and a.name(+)='Done';
Though I would lose the (+) in a.name(+) = 'Done' unless you want every name. -
Left Outer Join with more than two tables in both CR 8.5 and XIR2
I am trying to create a report and I have tried two versions of Crystal but I ultimately need the report in CR8.5 for compatibility with the client's system. I think I am starting to figure out what might be wrong and it might be my understanding of SQL, but I can't see why someone hasn't needed this in the past. Ultimately I want to see all projects and any journal entry that might be posted for that project.
Database is MySQL 5.0.38 and using MySQL ODBC driver 3.51.19.
Project header table information will be populated. Each line item on a journal entry can be tagged with the project ID. But for me to pull the journal entry date I need also to link to a third table for the journal entry header info.
I want to see all projects, whether a journal entry has been posted or not.
So the links are like this
ProjectHeader --->Left Outer Join ---> JELines ---> Inner Join ---> JEHeader
I think in this scenerio Crystal is treating the LOJ as an IJ.
I created two brand new reports today, one in CR8.5 and one in CR XIR2. Once I edited the automatic CR8.5 SQL statement (which I have been doing for years, usually without problem), they both ran properly. I linked customers to their invoices. Customers without invoices showed properly. But then I linked the invoices to the payments of the invoices and immediately lost customers without orders in both reports.
So apparently only two tables are allowed in Outer Joins. Does this make sense? I checked out the w3schools tutorial on SQL and it doesn't mention this limitation and I can't find anywhere else that it specifically indicates this but all samples of code I have seen only show two tables. I just thought for presentation as a sample that was easiest to understand and we could expand as necessary.
If this is correct, how does one go about accounting for this kind of thing? One solution that goes through my mind is creating a view at the database level for the link between journal entry lines and journal entry headers. Would this be a good solution under normal circumstances?
A second option that I had to implement because of timelines, is to use a subreport linked to the main report through the project ID to pull the information for the journal entries and just pass the totals I need to the main report through a shared variable.
These aren't normal circumstances because I don't have access to the database so I can't create the view. I have come across this concept several times and I have been able to use subreports to solve it but I am trying to find a better solution for the future as sometimes subreports can be slow. So are there any alternatives I have not considered here?
TIA rasincSo after some more work and another post. I was able to get this to work.
Items disappear when linking to another table
My issues were two fold. I was selecting on the tables on the right-side of the original Inner Join. However, I was checking for Nulls. This apparently is correct but you must check for the Nulls first eg. (IsNull (JEHeader.Field1) OR JEHeader.Field1 <= 100). I had my original statement reversed checking for <= 100 before checking for Nulls.
I also did not set all links to be Left Outer Join. I had the Inner Join. I actually have about 6 tables in this report so all the links need to be set Outer Join. So this now seems to be corrected.
Thanks -
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.
Maybe you are looking for
-
Hi guyz, I am trying to install Solaris 8 in a compaq machine. The installer started and proceeded until setting up of Time Zone. After that I got the following error: No disk found. Check cable or connection. Please help me to correct this error. re
-
Hi Friends, Could u plz tell me what is the use of Tcode: PDF* in ABAP HR. Then could u plz tell me how to modify the Payslip document in PE51.... plz send me some documents regarding the modification of... 1. Background 2. single field 3.window 4.l
-
Hi, i am trying to use an xsd with maxoccurs for a rule. The rule author converts this into a LIST. If i start now a BPEL process and assign the variables, the rules work on all items which are not LIST items. Is there a trick to use them in the rule
-
Creating developer users in SOA
Hello Can someone please reference me to a good link, book or whatever that discusses security in SOA? We are using SOA 11.1.1.7 with BPM, BPEL, BAM and OSB. I am having a hard time finding information on this topic and I don't want to give out the W
-
Flash Builder Premium 4.7 64 bits
Where can i find the setup of Flash Builder Premium 4.7 64 bits ?