Multiple fact - outer join
Hi all,
let's say that I created two facts
1) ALL_RELATIONS_FACTS: two dimensions
d1: START_POINT
d2: END_POINT
START_POINT END_POINT
1 2
3 4
1 3
A row in this fact means that the relationship exists, not all relationships will be measured
2) ALL_MEASURE_FACTS: three dimensions
d1: START_POINT
d2: END_POINT
d3: DATE
MEASURE1
MEASURE2
START_POINT END_POINT DATE MEASURE1 MEASURE2
1 2 20121023 100 200
3 4 20121023 300 400
A row in fact gives us measures on a certain date for a certain relationship.Now I would like to merge these two facts (with an OUTER JOIN).
START_POINT END_POINT DATE MEASURE1 MEASURE2
1 2 20121023 100 200
3 4 20121023 300 400
1 3 20121023Could someone point me to a standard solution?
Riccardo
I don't get why you are telling me "ONE" confirmed dimension.
My current BMM is
ALL_RELATIONS_FACTS
| |
start_point end_point
| |
D1 D2
| |
start_point end_point
| |
ALL_MEASURE_FACTS -------- DATE
Similar Messages
-
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'; -
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. -
Multiple left outer join in single select query
My client requires to apply multiple left outer join in single select query.
Tell me how it is possible . tell me if we can use native sql query.HI vineet,
Using multile left join is possible but it reduce performance as it takes a long time to retrieve data.
The following code would help you in knowing how to use multiple left join
REPORT test.
PARAMETERS:
p_auart LIKE vbak-auart.
DATA:
BEGIN OF fs_sales,
auart LIKE vbak-auart,
vbeln LIKE vbak-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
netwr LIKE vbap-netwr,
END OF fs_sales,
fs_temp LIKE fs_sales.
DATA:
t_sales LIKE STANDARD TABLE OF fs_sales.
SELECT k~auart
k~vbeln
p~posnr
p~matnr
p~netwr
INTO TABLE t_sales
FROM vbak AS k
OUTER JOIN vbap AS p
ON k~vbeln = p~vbeln
WHERE auart = p_auart
AND p~netwr LT 1000.
IF sy-subrc EQ 0.
WRITE:/5 'Sales Document'(001),/,
15 'Sales Document Item'(002),
40 'Material Number'(003).
sort t_sales by netwr ascending.
LOOP AT t_sales INTO fs_sales.
WRITE:/ fs_sales-vbeln under text-001.
LOOP AT t_sales INTO fs_temp WHERE vbeln = fs_sales-vbeln.
WRITE:/ fs_temp-posnr under text-002,
fs_temp-matnr under text-003.
ENDLOOP.
ENDLOOP.
ELSE.
MESSAGE 'No Record Found' TYPE 'I'.
ENDIF.
But i would suggest you to go with views instead of using multiple joins..
Best of luck,
Bhumika -
If you have multiple fact sharing the same dimensions is there a way to force the default Fact join path when pulling in only Dimensions? For instance pulling in Dashboard Prompts and using the Constrain - I pull in a few Dimensions and it obviously has to use the Fact table for the constaint, however, it is not using the one I am utilizing in the report. Thanks!
Yes, this functionality is called "Implicit fact", which means that this fact measure always be used when you run the query.
How to do this:
1) Create a measure on the fact table you want to create the join on.
2) In the presentation layer, go to the subject area and add this measure as the implicit fact.
3) Test it. Go to answers create a "dimension-only" report. Run the report and check the SQL to see whether the fact table is used.
Regards,
Stijn -
Hey all I'm on Oracle 10.2.0.0.3
I have the following SQL which works fine.
select *
FROM SYSADM.MASTER_ITEM_TBL A
left outer join
sysadm.ITEM_SPEX_PUR e
on
e.INV_ITEM_ID = a.INV_ITEM_IDIf I now wanted to add another Left outer Table join on sysadm.COMMENTS_TBL based on ITEM_SPEX_PUR.COMMENT_ID = COMMENTS_TBL.COMMENT_ID. I'm having a problem getting the correct syntax down.
Please help! Thanks!!Hi,
Maybe this:
select *
FROM SYSADM.MASTER_ITEM_TBL A
left outer join sysadm.ITEM_SPEX_PUR e on e.INV_ITEM_ID = a.INV_ITEM_ID
LEFT OUTER JOIN sysadm.comments_tbl c ON c.comment_id = e.comment_id
;If you'd like more help, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. -
Joining Multiple facts to the multiple Dimension tables
Hi All,
We have multiple fact tables which are Joined to common Dimension tables. We join them in physical layer and maintain Left outer join in the BMM. I do not get any consistency errors. But when I run report I get error.
"could not find level detailed enough for group by clause" any suggestion on the same.
The join Strucutre is as follows.
Facts - F1, F2, F3
Dim - D1, D2, D3
F1 --> D1, D2, D3
F2--> D1, D2,
F3--> D1, D2, D3
We cannot combine F2, F3 into F1 using multiple Logical Table Source.
What is the best way to achieve the above mentioned functionality.
Please advice.
Regards,
Narendra Shetty.Check this
OBI Error While Running Query
Update us back with solution, if helps pls mark
Edited by: Srini VEERAVALLI on Dec 20, 2012 7:13 AM -
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 -
Hi All,
I need to create multiple outer join in Discoverer.
My requirements is like this
I have a report where in I show the sales of components. I have Year as page item in Discoverer cross tab.
I have 2 years in my year table, 1999 and 2000
in the components table I have 3 components, X, Y, Z
In the fact table, I have 5 records as below
YEAR PRODUCT AMOUNT
1999 X 100
1999 Y 200
1999 Z 300
2000 X 400
2000 Y 500
Now with this data, when I create a cross tab with year as page item, I get the following output on selecting 1999 as year in page item,
component Amount SUM
X $100
Y $200
Z $300
similarly when I get report for 2000 it will be as follows
component Amount SUM
X $400
Y $500
Now I want some way to get a report as below for 2000 and similar cases
component Amount SUM
X 400
Y 500
Z 0
Can some body help me??
Thanks,Hi Mrutyunjay,
If you keep the query as described by Csaba but leave out time_period.year from the SELECT and GROUP BY list. In addition, replace the SUM(...) function with the following expression.
SUM (CASE WHEN <condition> THEN fact_tab.amount ELSE 0 END)
Where <condition> will be along the lines of 'time_period.year = 1999'.
This will give you the result you require.
Do be aware that this will force Oracle to do a full scan on the fact_tab table. This may render the solution unworkable.
Cheers,
denty. -
Join multiple fact tables and dimensions and use all tables in report issue
Hi,
I have a report requirements and need to use multiple fact tables and unconformed dimensions as described below
Fact table: F1,F2,F3
Dimensions tables: D1.....D9
F1:(joined to) D1,D2,D3,D4
F2::(joined to)D1,D2,D5,D6
F3::(joined to)D1,D2,D7,D8
D7::(joined to)D9,D8 (dimension D7 joined to two other dimensions D9 and D8
I'm trying to use columns from almost all the fact and dimension tables but getting "Unable to navigate requested expression. Please fix the metadata consistency warnings."
Repository is consistent and no errors and warnings.
How can I configure the repository to develop reports using all fact tables and dimensions?
Appreciate for your help.
Thanks
Jay.
Edited by: Jay on Feb 9, 2012 4:14 PMSo you want me to convert snowflake schema to star. does it solve my problem? individual star queries are working find but when I query multiple stars together getting inconsistency errors. I removed content tables dim level totals for unconformed dimensions in logical fact LTS and set level for measures at total level for unconformed dimensions. it is still in progress and need to test.
Thanks
Jay. -
Best Practice - Outer Join between Fact and Dim table
Hi Gurus,
Need some advice on the below scenario
I have an OOTB subject area and we have around 50-60 reports based on it. The related subject area Fact and Dim1 table are having inner join.
Now I have a scenario for one report where outer join has to be implemented between Fact and Dim1. Here I am against changing the OOTB subject area join as the outer join will impact the performance of other 50-60 reports.
Can anyone provide any inputs on what is the best way to handle this scenario?
ThanksOk. I tried this:
Driving table : Fact, Left outer join -- didnt work.
Driving table: Dimension D left outer join -- didnt work either
In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
And then I tried this -
Driving table: Fact, RIght outer join.
Now, this is giving me error:
Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
I checked all columns, everything matched with database table type and size.
I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number. -
Multiple Outer join in ORACLE 8.1.6
Hi ,
Can anybody suggest me how can i use multiple outer join on one table. I'm using ORACLE 8.1.6.
I know this version of oracle doesnt support this. But is there anmy other wa\y I can achieve this.
Thanks amd Regards
DeependraTricky question - but I went through this about 3 months ago, and found a good thread on here that explains it pretty well.
check out Re: Outer join a table with two diff table
You basically will have to create an inline view with one outer join in there, and then a second outer join on the outside. Read through the posts in that thread and it should help! -
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?
-
Query with multiple outer joins
I had a doubt with whether the following kind of query is valid with multiple outer-joins. The format of the query is something like this:-
select A.col1, B.col2
from table1 A, table2 B, table3 C where
A.col3=B.col4(+) and B.col5=C.col6(+)
This would mean the follwoing with regard to outer-joins in the query.
1) fetch records with col3 in table A matching or not matching col4 in table B
2) fetch records with col5 in table B matching or not matching col6 in table C
So, this query is valid?
I hope, my question is clear.
Please, help in solving the doubt.
regardsThis is valid and it works fine
-
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
Maybe you are looking for
-
Application hangs while running a report from Forms
Hi all, I am getting a problem regarding running reports from Oracle forms application for printing in a shared printer at client system. There is no problem when I set the DESTYPE to HTMLCSS or FILE. But when I set it to PRINTER then the application
-
How to open adobe acrobat reader without having to open photoshop?
how to open adobe acrobat reader without having to open photoshop? i keep getting this message when opening pdf files. "adobe acrobat was installed as part of a suite. to enable adobe acrobat, please start another component of this suite(such as phot
-
Hey all, Does Time Machine store backup data encrypted? Also, when backing up to a Time Capsule, is the data encrypted as it's being transmitted wirelessly? Thanks for the help. Mickey
-
Hi, I have a problem. i add some logic in Functional location cmod. every things are wroking fine but the problem is now it is taking 4h to load data before it takes 45min, most of the time taken to fill the internal tables please someone help me to
-
Saving a Transition with a video clip...
I am using an Edge Wipe transition, which I painstakingly synchronized with a clip of a car driving by. I would like to be able to re-apply the wipe and the car driving by several times throughout my sequence. Is there a way to do this in one move? i