Outer join of OBIEE 10 G
Hi, I'm new to OBIEE 10 G.
I have a DimA (dimension), memoirs (fact). I traced the foreign key relationship between DimA and briefs on DimA.A = FactA.A MDB, the relationship is internal and greyed out, so I can't change it to outer join.
So in the report answers, it only shows data for the inner join of the two tables. What I want is to show all items in DimA and associated items FactA or 0 for those not related.
I posted a similar question here before https://forums.oracle.com/thread/2596618
But I can't always change the relationship (still dimmed) even though I opened a deposit in offline mode.
And what I think is is an option in responses to dynamically control the join (internal or external). For example, sometimes I want to show only paired DimA and FactA, sometimes all the DimA and related FactA or 0, so that I do not change the repository MDB every time if the requirement is changed.
What is the best practice in this case?
Thank you.
Try opening the SPR OFFLINE, or to open in mode online and starting then other CASES it would be gray.
If you have trouble sending the RPD to sveerava at gm
Tags: Business Intelligence
Similar Questions
-
outer join does not give the expected results (missing documents)
Hello
I have problem with outer join in OBIEE 10 g.
I'm testing it on the model of simplified database
STAT table with some statistics of TYPEs
stat_date, id_type, num
..
..
26/03/2003, 20: 1
26/03/2003, 21: 1
26/03/2003, 23: 1
26/03/2003, 24, 1
26/03/2003, 25, 1
..
27/03/2003, 22, 1 <-different date here
..
..
Table TYPES
ID_type
..
..
20
21
22
23
24
25
..
..
Physical model
STAT >-TYPES
AM.
F1 (only Digital STAT table column (agg. County))
D1 (STAT_DATE of the STAT table column only)
D2 (source TYPES)
D1 - inner join - < F1
D2 - left outer join - < F1
I would like to create simple report filtered by date with number of each type.
I want to get this result
ID_type County
.. ..
.. ..
20 1
21 1
22 null
23 1
24 1
25 1
.. ..
.. ..
But I get this
ID_type County
.. ..
.. ..
20 1
21 1
23 1
24 1
25 1
.. ..
.. ..
ID_type 22 is missing
!!!
I NORMALLY GET RESULT ONLY IF I DELETE RECORD ' 27/03/2003 22' OF MY FACT TABLE.
!!!
I have the filter on the date column D1
STAT_DATE = 26/03/2003 or STAT_DATE is null
BI Server running this SQL query
Select distinct D1.c1 as c1,
D1. C2 C2
Of
(select count (T17840. NUM) in c1.
T17867.ID_TYPE C2
Of
Left outer join of TYPES T17867
STAT T17840 on T17840.ID_TYPE = T17867.ID_TYPE
where (T17840. STAT_DATE in (TO_DATE ('2003-03-26', 'YYYY-MM-DD')) or T17840. STAT_DATE is null)
T17867.ID_TYPE group
) D1
Can you give me some advice?
Thank youHi cardel,
I think that you can achieve your goal if you build a dimension of the array STAT form, you can create a table Alias in the physical layer and then to join the table of facts (external to the left). In this way, I think that you can solve your problem.
Let me know.
Kind regards
Gianluca -
Hello
I have create a join foreign key between the table dimension and in the physical layer. Is it possible to create an outer join on the columns, the option (driving and type) in properties is gray and is by default 'indoor '. How you can activate this option?
Thank youHello
You create outer joins in the business layer, but the OBIEE outer joins are not like SQL outer join. They can lead to strange errors.
Its better to do these things in ETL.
Thank you
Sandeep -
Hi Experts,
I have a requirement that says - see the chart for the past 10 days, regardless the presence data table in fact.
Lets consider an example - Time_dim product, are my dimension tables, Purchase_Order is my fact table.I did it for external Purchase_Order in left RPD with TIME_DIM and inner join with the PRODUCT table. and execution of query of exit-
Select T.Date, P.item, count (distinct PO.order_no)
TIME_DIM t, PRODUCT P, PURCHASE_ORDER PO
where T.date_key = PO.date_key
and P.item = in. agenda
and P.item = 'laptop ';The query generated by OBIEE left outer join, but when the condition P.item = "Notebook" included in the query, and if there are no orders for this product in one of the date, that date will not come in the result set.
the query to be generated by the OBIEE is-
Select T.Date, PO.item, count (distinct PO.order_no)
TIME_DIM t,.
(SELECT P.ITEM, IN. ORDER_NO
PRODUCT P, PO PURCHASE_ORDER
WHERE P.item = in. agenda
and P.item = 'Laptop') IN.
WHERE T.date_key = PO.date_key (+);How to design the RPD to achieve this. All pray to advise on this. Thanks in advance.
Thank you
ChantalHello
You are on 11.1.1.7?
I would say that your condition can be made without using external and maintenance of product and the standard between the FACT dimension, time inner join join.
If you enable your property analysis OBIEE "Include Null values" will automatically return all the elements of time and product matching your filter (so you'll need to add a filter on 'Date' to limit it to the last 10 days or you will have a unique day of your time dimension).
If you filter then on "Laptop", even if there is not a single value in order for "Laptop" in the last 10 days, he will be there on the screen.
Easy, clean and you keep your inner join between the facts and Dimensions.
Take a look at this example, I just did on SampleApp 406:
Selection of 12 months (year 2010) and a customer (id = 89) and income. The model has only an inner join. I activate the option "Include Null values" and here is the result.
A line with cells only empty because there is not a single revenue for customer 89 in 2010. This is exactly your condition.
Honestly, do not touch your model using the outer join, you will have more side effects than benefits. Every single scan will do the outer join and you'll have a lot of data 'empty' return of the DB (more large data set containing just the null values) and probably you need the outer join in 15 to 25% of your analysis.
Keep things simple, it will be faster and easier to maintain.
-
complete elimination of an outer join
Hi all
I'm reporting two fact tables. However, despite the use of inner joins only in the RPD, obiee generates a full outer joins between the two WITH (subquery factoring). Is it possible to apply inner joins.
Thank you
Surya872073 wrote:
All in RPD joins are inner joins. The generated query is similar as follows. The full outer join is created automatically between SAWITH0 SAWITH1WITH
SAWITH0 AS (SELECT sum (T245. QUANTITY_SOLD) AS c1,.
T161. CHANNEL_DESC AS c2
Of
SH. T161 CHANNELS,
HS SALES T245
WHERE (T161. CHANNEL_ID = T245. CHANNEL_ID)
T161 GROUP. CHANNEL_DESC),
SAWITH1 AS (SELECT sum (T168. UNIT_COST) AS c1,.
T161. CHANNEL_DESC AS c2
Of
SH. T161 CHANNELS,
HS FEES T168
WHERE (T161. CHANNEL_ID T168 =. CHANNEL_ID)
T161 GROUP. CHANNEL_DESC)
SELECT DISTINCT cases where SAWITH1.c2 IS NOT NULL, then SAWITH1.c2 when SAWITH0.c2 IS NOT NULL then SAWITH0.c2 end AS c1,
C2 SAWITH0. C1 DID,
SAWITH1. C1 AS c3
Of
SAWITH0 FULL OUTER JOIN SAWITH1 ON SAWITH0.c2 = SAWITH1.c2
ORDER BY c1If I change the underlined FULL OUTER JOIN just preceding 'JOIN', the query returns I want.
Published by: 872073 on October 24, 2012 13:14
Check if PERF_PREFER_INTERNAL_STITCH_JOIN has been disabled in the file DB Features.ini
The path to the file is Oracle/Middleware/instances/instance1/config/OracleBIServerComponent/coreapplication_obis1/DBFeatures.INI
-
Show all dates between date range (time Dimension is left outer join)
All,
I did some research on this issue, but in all positions on date variables, date prompts and date filtering I have not seen one exactly to my question (perhaps that they are and I don't have my head around it properly yet).
My requirement of report is to allow a user to select a start date and an end of day. The report is expected to show the activity of these two days - AND display 0/null on days where there is no activity. This second part is where I am getting hung up.
The paintings in question are:
Timedim
EventFact
CustomerDim
My MDB is configured as follows:
Left outer join of Timedim EventFact
Inner join CustomerDim EventFact
If I run a report by selecting the DAYS of Timedim and an EventFact measure1 with range day 01/01/2010-31/12/2010... A record for each day and it looks perfect because of the left outer join between Timedim and CustomerDim.
But... If I add a CustomerDim field, Select TimeDim.DAY, CustomerDim.CUSTNAME, EventFact.MEASURE1, OBIEE returns only records for the days that have record EventFact.
This is due to the fact that the Timedim is always external joined in EventFact, but adding in fact CustomerDim OBIEE set up an inner join between tables that will only return data where there are data EventFact.
There is a way around it in this simple case, and that is to define the relationship between CustomerDim and EventFact as an outer join as well. This will give the desired effect (but an outer join between the two tables is not the real relationship) and I have add an extra dimension and add additional sources of logic to a single dimension in MDB it becomes complicated and messy.
Also, ive ruined with the definition of the conduct in the relationship table, etc... but he gave not the desired effect.
Has anyone ever met the need for force display all dates within a range specified with a fact table that does not have an entry for each date?
Thanks in advance.
K
Published by: user_K on April 27, 2010 11:32Hi there, the easiest way is to the LTS himself. Double-click your LTS, go to the tab with the column mappings. Make sure you have checked "show no mapped" column.
You should see your new dummy column in the list, in the central part of mapping (IE not the right) just enter 0, or launch the expression editor and enter 0 in there.
simple! -
Outer joins for multiple columns
I have a data model that is simple, consisting of two dimension tables and one fact table. The fact table contains two columns of dimension and the column of a fact.
The dimensions are time and channel (from a Global schema). The dimension in the fact table columns are months and the track, which are the lowest in their respective dimensions. The column is for sale.
Not all combinations of time and channel data available, because our data goes back to 1998, but we don't sell through the Internet channel until 2001.
A simple request for monthly responses, channels, and sales returns just what you would expect - only the lines that actually have data in the fact table.
I would like to see all THE combinations of month and channel, regardless of whether or not there is a line in the fact table. I was under the impression that the definition of the join would type Left Outer in the complex join in the model diagram of Business happening. I did, as well affecting the Left Outer relations. The resulting SQL code looks like this:
Select T68. MONTHS in the c1 form,
T50. CHANNEL C2,
sum (T514. Turnover) in c3,.
T68. MONTH_END_DATE as c4
Of
T68 BI_D_TIME left (outer join
Left outer join BI_D_CHANNEL T50
BI_F_SALES T514 on T50. CHANNEL = T514. CHANNEL) on T68. MONTH = T514. MONTH
Group of T50. CHANNEL, T68. MONTHS, T68. MONTH_END_DATE
order of c4, c2
Unfortunately, that SQL is not what I want it to do. It returns the same results as above - namely, only the lines that exist in the fact table. I confirmed that by running the code in SQL Developer. It returns one row for each month, but it returns a line for each combination of months and channel.
For example, in Jan98, I get a line for the channel catalog, but not for the Internet or directly. Dec05, I get a line with Dec05 as month, NULL as the canal and of course NULL as sales. What I'd like TO see for each month is three lines, each line containing one of the three values of channel, if this month/channel combination had no sale or not.
Is it possible to change the repository to accomplish what I want to do?Check here how you can make densification on an environment of ROLAP
http://gerardnico.com/wiki/dat/OBIEE/bi_server/design/obiee_densificationSee you soon
Nico -
SSRS for lack of outer join with the Oracle data source
It seems to be a problem with the Oracle driver used in the Reporting SERVICES query designer.
When you use an Oracle data source, if I create an outer join in the graphic designer, it automatically inserts '{OJ' before the join and '} ' after her. This is an incorrect syntax for Oracle and refuses to start. The curly braces and the JO editable in designer text, but if I go back to the graphic designer and immediately to reintegrate them.
Only, this has started to happen a year or two ago - before that it worked, but with the old (+) syntax.
Can it not be healed? It makes things very difficult.
-Geoff
Hi Geoff,
Thanks for posting in the Microsoft Community.
However, the question you posted would be better suited in the Forums of the Oracle Support; We recommend that you post your query in Oracle Support Forums to get help:
If you have any other questions or you need Windows guru, do not hesitate to post your questions and we will be happy to help you.
-
HELP SQL (auto / full outer join with date corresponding)
I'm having a hard time get this query nailed... hoping someone can help me sorted.
create table tab1 (identification number,
date of eff_date,
Code1 varchar2 (2),
Code2 varchar2 (2)
)
/
insert into tab1 values (2, to_date('2015-01-14','YYYY-MM-DD'), 'DAT', 'AS');
insert into tab1 values (2, to_date('2015-03-19','YYYY-MM-DD'), 'DAT', 'AS');
insert into tab1 values (2, to_date('2015-08-28','YYYY-MM-DD'), 'DAT', 'AS');
insert into tab1 values (2, to_date('2015-11-12','YYYY-MM-DD'), 'DAT', 'AS');
insert into tab1 values (2, to_date('2015-01-03','YYYY-MM-DD'), "DAT", "AE");
insert into tab1 values (2, to_date('2015-03-14','YYYY-MM-DD'), "DAT", "AE");
insert into tab1 values (2, to_date('2015-04-18','YYYY-MM-DD'), "DAT", "AE");
insert into tab1 values (2, to_date('2015-09-14','YYYY-MM-DD'), "DAT", "AE");
insert into tab1 values (2, to_date('2015-01-14','YYYY-MM-DD'), "DAT", "BS");
insert into tab1 values (2, to_date('2015-02-14','YYYY-MM-DD'), "DAT", "BS");
insert into tab1 values (2, to_date('2015-03-14','YYYY-MM-DD'), "DAT", "BS");
insert into tab1 values (2, to_date('2015-05-14','YYYY-MM-DD'), 'DAT', 'BE');
insert into tab1 values (3, to_date('2015-09-16','YYYY-MM-DD'), 'DAT', 'AS');
insert into tab1 values (3, to_date('2015-04-16','YYYY-MM-DD'), "DAT", "AE");
tab1
ID, date, code 1, code2
2. DID DAT 2015-01-14
2. DID DAT 2015-03-19
2. DID DAT 2015-08-28
2. DID DAT 2015-11-12
2 AE DAT 2015-01-03
2 AE DAT 2015-03-14
2 AE DAT 2015-04-18
2 AE DAT 2015-09-14
2 BS DAT 2015-01-14
2 BS DAT 2015-02-14
2 BS DAT 2015-03-14
BE DAT 2 2015-05-14
3. DID DAT 2015-09-16
3 AE DAT 2015-04-16
What I need to do...
1 auto join to match EI for each partition ID
2. THAT the date must be less than or equal to the date of the AE and when there is more then a line corresponding to this criterion has chosen the date of closest EI of the date of the ACE.
3. it must be a full outer join because I want to show all lines, even if it is not a match. There is a beginning, but not record end end gold but no record of departure
4. If there is an AE line for many AS lines (the SA date is less then equals the date of EI) then join this AE line to all 3 rows of ACE
5. the same rules for BS and BE.
result should look like this.
ID, date, code 1, id_1 code2, date_1, code1_1, code2_1
2 2015-01-14 DAT AS 2 AE DAT 2015-03-14
2 2015-03-19 DAT AS 2 AE DAT 2015-04-18
2 2015-08-28 DAT AS 2 AE DAT 2015-09-14
2 2015-11-12 DAT DID ZERO ZERO ZERO ZERO
NO NO NO NO 2 AE DAT 2015-01-03
2015-01-2 14 DAT BS 2 BE DAT 2015-05-14
2015-02-2 14 DAT BS 2 BE DAT 2015-05-14
2015 03-2 14 DAT BS 2 BE DAT 2015-05-14
3 2015-09-16 DAT DID ZERO ZERO ZERO ZERO
NO NO NO NO 3 AE DAT 2015-04-16
My attempt was somewhat along these lines (dealing only with SA / combos AE) but it does not manage the many scenarios one (req 4).
Select a.*, b.* from
(select row_number () on the rn (partition by a.id order a.eff_date), a.*)
of tab1 where a.code2 = 'AS') a
full outer join
(select row_number () on the rn (b.eff_date order by b.id partition), b.*)
tab1 b where b.code2 = 'Æ') b
on a.id = b.id
and a.rn = b.rn
and a.eff_date < = b.eff_date
Hello
owbdev99 wrote:
I'm having a hard time get this query nailed... hoping someone can help me sorted.
create table tab1 (identification number,
date of eff_date,
Code1 varchar2 (2),
Code2 varchar2 (2)
)
/
insert into tab1 values (2, to_date('2015-01-14','YYYY-MM-DD'), 'DAT', 'AS');
...
Thanks for posting the CREATE TABLE and INSERT. I know it can be a lot of trouble. You want to get answers that work, not you? Make sure that the statements you post too much work. Test (and, if necessary, attach) your statements before committing. You said code1 be VARCHAR2, but all the instructions insertion have values of 3 characters for code1.
You are on the right track, with an analytical function, but ROW_NUMBER solves this problem. 1 "THAT line" could correspond to the 1st, 2nd, 3rd or any other line 'AE' and vice versa. Try to use the analytical MIN function instead or ROW_NUMBER, like this:
WITH got_next_e_date AS
(
SELECT id, eff_date, code1, code2
MIN (CASE
WHEN SUBSTR (code2, 2) = 'E '.
THEN eff_date
END
) OVER (PARTITION BY ID.
, SUBSTR (code2, 1, 1)
ORDER BY eff_date DESC
) AS next_e_date
OF tab1
)
s AS
(
SELECT *.
OF got_next_e_date
"WHERE SUBSTR (code2, 2) s ="
)
e
(
SELECT *.
OF got_next_e_date
WHERE SUBSTR (code2, 2) = 'E '.
)
SELECT s.id
s.eff_date
s.code1
s.code2
e.id AS id_1
e.eff_date AS eff_date_1
e.code1 AS code1_1
e.code2 AS code2_1
S
FULL OUTER JOIN e ON s.id = e.id
AND s.next_e_date = e.eff_date
AND SUBSTR (s.code2, 1, 1) = SUBSTR (e.code2, 1, 1)
ORDER OF NVL (s.id, e.id)
, NVL (SUBSTR (s.code2, 1, 1)
, SUBSTR (e.code2, 1, 1)
)
s.eff_date
;
Out (as you asked):
ID EFF_DATE CODE1, CODE2 ID_1 EFF_DATE_1 CODE1_1 CODE2_1
--- ---------- ----- ----- ----- ---------- ------- -------
2 2015-01-14 DAT AS 2 AE DAT 2015-03-14
2 2015-03-19 DAT AS 2 AE DAT 2015-04-18
2 2015-08-28 DAT AS 2 AE DAT 2015-09-14
2. DID DAT 2015-11-12
2 AE DAT 2015-01-03
2015-01-2 14 DAT BS 2 BE DAT 2015-05-14
2015-02-2 14 DAT BS 2 BE DAT 2015-05-14
2015 03-2 14 DAT BS 2 BE DAT 2015-05-14
3. DID DAT 2015-09-16
3 AE DAT 2015-04-16
I guess code2 is always 2 characters, and the 2nd character is always ' or 'E '.
I assume that the combination [id, eff_date, code2] is unique.
If these assumptions are wrong, you need a few minor changes, but nothing big.
-
Bug with an outer join, or &; Analytics function (or rownum)
Hello
Seems to be a combination of an outer join, OR and rownum confuses the CBO.
First request is without rownum, the second is with rownum.
The second query expects 203 t lines and never ends. It should behave the same as query 1, with 24 M lines.
Remove the GOLD clause query 2 allows him to behave as a query 1, with 24 M lines.
We never saw it? Is there a solution?
SELECT * FROM message i LEFT JOIN (SELECT hi.message_id, hi.update_dt FROM message_hist hi) h ON (t.id = h.master_id AND(t.update_dt = h.update_dt OR h.update_dt <TO_DATE('150901','RRMMDD'))); ----------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 24M| 13G| 475G (2)|999:59:59 | | 1 | NESTED LOOPS OUTER | | 24M| 13G| 475G (2)|999:59:59 | | 2 | TABLE ACCESS FULL | MESSAGE | 8037K| 1318M| 29883 (2)| 00:06:59 | | 3 | VIEW | | 3 | 1302 | 59136 (2)| 00:13:48 | |* 4 | TABLE ACCESS FULL| MESSAGE_HIST | 3 | 168 | 59136 (2)| 00:13:48 | ----------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - filter("I"."MESSAGE_ID"="HI"."MESSAGE_ID" AND ("HI"."UPDATE_DT"<TO_DATE('150901','RRMMDD') OR "I"."UPDATE_DT"="HI"."UPDATE_DT")) ---------------- SELECT * FROM message i LEFT JOIN (SELECT hi.message_id, hi.update_dt , ROWNUM FROM message_hist hi) h ON (t.id = h.master_id AND(t.update_dt = h.update_dt OR h.update_dt <TO_DATE('150901','RRMMDD'))); ------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 203T| 112P| 475G (2)|999:59:59 | | 1 | NESTED LOOPS OUTER | | 203T| 112P| 475G (2)|999:59:59 | | 2 | TABLE ACCESS FULL | MESSAGE | 8037K| 1318M| 29883 (2)| 00:06:59 | | 3 | VIEW | | 25M| 10G| 59151 (2)| 00:13:49 | |* 4 | VIEW | | 25M| 10G| 59151 (2)| 00:13:49 | | 5 | COUNT | | | | | | | 6 | TABLE ACCESS FULL| MESSAGE_HIST | 25M| 1355M| 59151 (2)| 00:13:49 | ------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - filter("I"."MESSAGE_ID"="H"."MESSAGE_ID" AND ("I"."UPDATE_DT"="H"."UPDATE_DT" OR "H"."UPDATE_DT"<TO_DATE('150901','RRMMDD')))
RowNum in a subquery is supposed to ensure that the subquery is evaluated completely before filtering, otherwise, how could you go out rownum?
Your question is compounded because of the join condition that forces a level of nested loops, which means that the table should be fully analysed once for each line of conduct rowsource. You can either transform the join in an equijoin and allow a hash to run, or you join could materialize the subquery once.
Allow the hash join:
SELECT count (*)
Message FROM
LEFT JOIN (SELECT hi.message_id, hi.update_dt
ROWNUM
OF message_hist salvation) PM ON (i.message_id = h.message_id
AND i.update_dt = h.update_dt)
LEFT JOIN (SELECT hi.message_id, hi.update_dt
ROWNUM
OF message_hist salvation) h2 ON (i.message_id = h2.message_id
AND h2.update_dt<>
AND h2.update_dt <> i.update_dt)
/
----------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1. 66. 211 (1) | 00:00:01 |
| 1. GLOBAL TRI | | 1. 66. | |
|* 2 | EXTERNAL RIGHT HASH JOIN | | 800 | 52800 | 211 (1) | 00:00:01 |
|* 3 | VIEW | | 1. 22. 70 (0) | 00:00:01 |
| 4. COUNTY | | | | | |
| 5. TABLE ACCESS FULL | MESSAGE_HIST | 1. 22. 70 (0) | 00:00:01 |
|* 6 | EXTERNAL RIGHT HASH JOIN | | 800 | 35200. 141 (1) | 00:00:01 |
| 7. VIEW | | 1. 22. 70 (0) | 00:00:01 |
| 8. COUNTY | | | | | |
| 9. TABLE ACCESS FULL | MESSAGE_HIST | 1. 22. 70 (0) | 00:00:01 |
| 10. TABLE ACCESS FULL | MESSAGE | 800 | 17600 | 70 (0) | 00:00:01 |
----------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
2 - access("I".") MESSAGE_ID '= 'H2'.' MESSAGE_ID "(+))"
filter ("H2". "UPDATE_DT" (+)<>'I'. " ("' UPDATE_DT")
3 - filter("H2".") UPDATE_DT "(+)<>
6 - access("I".") "UPDATE_DT" ="H" UPDATE_DT "(+) AND"
"I"." ' MESSAGE_ID ' ="H" MESSAGE_ID "(+))"
Materialize the subquery:
WITH h AS (SELECT / * + MATERIALIZE * / hi.message_id, hi.update_dt)
ROWNUM
OF message_hist salvation)
SELECT count (*)
Message FROM
LEFT JOIN: ON (i.message_id = h.message_id
AND (i.update_dt = h.update_dt OR h.update_dt<>
----------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
----------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1. 22. 1740 (0) | 00:00:01 |
| 1. TRANSFORMATION OF THE TEMPORARY TABLE. | | | | |
| 2. LOAD SELECT ACE | SYS_TEMP_0FD9D6810_5B8F6E67 | | | | |
| 3. COUNT | | | | | |
| 4. TABLE ACCESS FULL | MESSAGE_HIST | 1. 22. 70 (0) | 00:00:01 |
| 5. GLOBAL TRI | | 1. 22. | |
| 6. NESTED EXTERNAL LOOPS | | 800 | 17600 | 1670 (0) | 00:00:01 |
| 7. TABLE ACCESS FULL | MESSAGE | 800 | 17600 | 70 (0) | 00:00:01 |
| 8. VIEW | | 1. | 2 (0) | 00:00:01 |
|* 9 | VIEW | | 1. 22. 2 (0) | 00:00:01 |
| 10. TABLE ACCESS FULL | SYS_TEMP_0FD9D6810_5B8F6E67 | 1. 22. 2 (0) | 00:00:01 |
----------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
9 - filter("I".") ' MESSAGE_ID ' ="H" MESSAGE_ID' AND ('I'. "" "UPDATE_DT"="H" UPDATE_DT' OR
"H"." UPDATE_DT ".<>
You may need to change the first condition to make sure that you select the correct subquery.
-edit
Not able to view a plan but you can invade the second join condition select and then the result of a subquery with a predicate according to your requirement. This should delay the or rating and leave only an equijoin (although rowsource return may be slightly larger than the opposite).
-Second edition, it did not work exactly when I tried it.
A hybrid of the previous two plans with a slight modification of how he was imitating the GOLD:
WITH h AS (SELECT / * + MATERIALIZE * / hi.message_id, hi.update_dt)
ROWNUM Clotilde
OF message_hist salvation)
SELECT i.MESSAGE_ID
i.UPDATE_DT
COALESCE(h.message_id,h2.message_id) message_id
, COALESCE (h.update_dt, h2.update_dt) update_dt
Clotilde COALESCE (h.rown, h2.rown)
Message FROM
LEFT JOIN: ON (i.message_id = h.message_id
AND i.update_dt = h.update_dt)
LEFT JOIN: h2 WE (DECODE(h.message_id,,i.message_id) = h2.message_id - only try this if previous join returned NULL
AND h2.update_dt<>
/
--------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
--------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1. 66. 8 (0) | 00:00:01 |
| 1. TRANSFORMATION OF THE TEMPORARY TABLE. | | | | |
| 2. LOAD SELECT ACE | SYS_TEMP_0FD9D6605_28F27F | | | | |
| 3. COUNT | | | | | |
| 4. TABLE ACCESS FULL | MESSAGE_HIST | 150. 3300 | 2 (0) | 00:00:01 |
| 5. GLOBAL TRI | | 1. 66. | |
|* 6 | EXTERNAL RIGHT HASH JOIN | | 10497. 676K | 6 (0). 00:00:01 |
|* 7 | VIEW | | 150. 3300 | 2 (0) | 00:00:01 |
| 8. TABLE ACCESS FULL | SYS_TEMP_0FD9D6605_28F27F | 150. 3300 | 2 (0) | 00:00:01 |
|* 9 | OUTER HASH JOIN | | 328. 14432 | 4 (0) | 00:00:01 |
| 10. TABLE ACCESS FULL | MESSAGE | 200 | 4400 | 2 (0) | 00:00:01 |
| 11. VIEW | | 150. 3300 | 2 (0) | 00:00:01 |
| 12. TABLE ACCESS FULL | SYS_TEMP_0FD9D6605_28F27F | 150. 3300 | 2 (0) | 00:00:01 |
--------------------------------------------------------------------------------------------------------Information of predicates (identified by the operation identity card):
---------------------------------------------------6 - access("H2".") MESSAGE_ID "(+) = DECODE (TO_CHAR ('H'". "))" MESSAGE_ID"), NULL, 'I '. (("' MESSAGE_ID '))
7 - filter("H2".") UPDATE_DT "(+)<>
9 - access("I".") "UPDATE_DT" ="H" UPDATE_DT "(+) AND 'I'." "" ' MESSAGE_ID '="H" MESSAGE_ID "(+))"(This plan is another system if costs are not comparable)
-
Outer join does not not as expected left
Hi all
I have it here are three tables with values. Mentioned the under outer join query does not and behave like the inner query.
CREATE TABLE RET_FUND_FEE
(
NPTF VARCHAR2 (8 CHAR),
TPART VARCHAR2 (4 CHAR)
);
CREATE TABLE PART_PTF
(
Mf_Id VARCHAR2 (6 CHAR) NOT NULL,
TPARTS VARCHAR2 (4 CHAR) NOT NULL
);
CREATE TABLE TFC_FUNDS
(
NPTF VARCHAR2 (8 CHAR) NOT NULL,
MULTIFONDS_ID VARCHAR2 (6 CHAR)
);
INSERT INTO RET_FUND_FEE VALUES('111','A');
INSERT INTO RET_FUND_FEE VALUES('111','D');
INSERT INTO RET_FUND_FEE VALUES('111','E');
INSERT INTO PART_PTF VALUES ('MF1', 'A');
INSERT INTO PART_PTF VALUES ('MF1', 'B');
INSERT INTO PART_PTF VALUES('MF1','C');
INSERT INTO TFC_FUNDS VALUES('111','MF1');
INSERT INTO TFC_FUNDS VALUES('111','MF1');
INSERT INTO TFC_FUNDS VALUES('111','MF1');
SELECT A.TPART, B.TPARTS, A.NPTF, B.Mf_Id, C.MULTIFONDS_ID, C.NPTF
OF RET_FUND_FEE A, PART_PTF B, TFC_FUNDS C
WHERE A.NPTF = C.NPTF
AND C.MULTIFONDS_ID = B.Mf_Id
AND A.TPART = B.TPARTS (+)
AND C.MULTIFONDS_ID = 'MF1 '.
AND C.NPTF = '111'
Here, I expect all records in the RET_FUND_FEE table that I am using outer join.
But I'm only corresponding chronogram RET_FUND_FEE, PART_PTF as an inner join. Can you get it someone please let me know what lack us.
Is my version of oracle 11g
SELECT
A.TPART, B.TPARTS, A.NPTF, B.Mf_Id, C.MULTIFONDS_ID, C.NPTF
Of
PART_PTF B
Join
C TFC_FUNDS
on (C.MULTIFONDS_ID = B.Mf_Id
AND C.MULTIFONDS_ID = 'MF1 '.
AND C.NPTF = '111'
)
right outer join
RET_FUND_FEE HAS
on (A.TPART = B.TPARTS
and A.NPTF = C.NPTF) - added as correction
TPART TPARTS NPTF MF_ID MULTIFONDS_ID NPTF A A 111 MF1 MF1 111 A A 111 MF1 MF1 111 A A 111 MF1 MF1 111 E - 111 - - - D - 111 - - - or
SELECT A.TPART, d.TPARTS, A.NPTF, d.Mf_Id, d.MULTIFONDS_ID, d.NPTF
OF RET_FUND_FEE HAS
, (
Select
*
PART_PTF b, TFC_FUNDS C
where B.Mf_Id = C.MULTIFONDS_ID
AND C.MULTIFONDS_ID = 'MF1 '.
AND C.NPTF = '111'
) d
WHERE A.TPART = D.TPARTS (+)
and A.NPTF = D.NPTF (+) - added as a correction
Sorry had to correct the syntax oracle solution.
The first one was bad because it would return also B lines that have no match in C.
Sorry a correction more on these two approaches, missed the second predicate.
-
Oracle: Use LEFT OUTER JOIN, but convert the data to an external list
Hello, all,.
I know it can be done; I just don't remember how I got it done, oh there are so many years.
Assumes that the tables exist for groups and individuals. People can belong to several groups.
SELECT g.groupName, p.lastName || ', ' || p.firstName as fullName FROM groups g LEFT OUTER JOIN groupPersonAssociation gpa ON gpa.groupID = g.groupID LEFT OUTER JOIN person p ON p.personID = gpa.personID ORDER BY g.groupName, fullName
This gives us:
Group One Alpha, Daniel Group One Bravo, Charles Group One Charlie, Chuck Group Two Beta, Alpha Group Two Delta, Bonnie Group Three Echo, Bunny Group Three Golf, Samuel Group Three November, Stan
How word the SQL to get the data as:
Group One Alpha, Daniel | Bravo, Charles | Charlie, Chuck Group Two Beta, Alpha | Delta, Bonnie Group Three Echo, Bunny | Golf, Samuel | November, Stan
V/r,
^_^
I finally thought to it. I was using incorrect keywords on Google.
SELECT g.groupName, LISTAGG(p.lastName || ', ' || p.firstName,' | ') WITHIN GROUP (ORDER BY g.groupName) "fullName" FROM groups g LEFT OUTER JOIN groupPersonAssociation gpa ON ggpa.groupID = g.groupID LEFT OUTER JOIN person p ON p.personID = gpa.personID GROUP BY g.groupName ORDER BY g.groupName, fullName
Just in case someone else is going through this same desire.
HTH,
^_^
-
using outer joins if the two column is null? Use only (+)
Hi all
create the table xxc_tr_num (tl_number number, tr_no number tl_no_id);
insert into xxc_tr_num values (123,100,222);
insert into xxc_tr_num values (124,100,333);
create the table xxc_od_tab (tl_number number, tl_id number);
insert into xxc_od_tab values (123,001);
insert into xxc_od_tab values (null, null);
create table xxc_oth_tab (name varchar2 (10), number of tl_id);
insert into xxc_oth_tab values('abc',,001);
insert into xxc_oth_tab values (null, null);
Wait it out put
tr_no tl_no_id name
100 222 abc
100 333
using outer joins if the two column is null? use only please of outer joins
And I tried to use outer joins on both tl_id column but not get values and I use have County (tr_no ) > 1
Rajesh123 wrote:
Thank you Kiss it is not possible to use having clause?
You need to understand the functioning of the group. If you will not be asked this question.
Check this box
SQL> select tr_no, 2 tl_no_id, 3 count(*) 4 from xxc_tr_num a, 5 xxc_od_tab b, 6 xxc_oth_tab c 7 where a.tl_number = b.tl_number(+) 8 and b.tl_id = c.tl_id(+) 9 group 10 by tr_no 11 , tl_no_id; TR_NO TL_NO_ID COUNT(*) ---------- ---------- ---------- 100 333 1 100 222 1
See what returns the count? You have grouped according to TR_NO and TL_NO_ID. You must take into consideration the TL_NO_ID just put COUNT (TR_NO) does not increase the NUMBER of the whole group. To get the NUMBER on the whole group, I used the analytical function and did. Like this, see the number of the analytical function here
SQL> select tr_no, 2 tl_no_id, 3 count(*), 4 count(*) over(partition by tr_no) 5 from xxc_tr_num a, 6 xxc_od_tab b, 7 xxc_oth_tab c 8 where a.tl_number = b.tl_number(+) 9 and b.tl_id = c.tl_id(+) 10 group 11 by tr_no 12 , tl_no_id; TR_NO TL_NO_ID COUNT(*) COUNT(*)OVER(PARTITIONBYTR_NO) ---------- ---------- ---------- ------------------------------ 100 222 1 2 100 333 1 2
So to answer your question, yes you can't do in the HAVING clause...
-
Hi all
I use under version
Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0
SQL > SELECT E.ENAME,.
2 D.DEPTNO,
3 D.LOC
4. TO EMP E,.
DEPT 5 D
6. WHERE = E.DEPTNO D.DEPTNO (+);
ENAME, DEPTNO LOC
---------- ------ -------------
DALLAS SMITH 20
ALLEN 30 CHICAGO
WARD 30 CHICAGO
20 DALLAS JONES
MARTIN 30 CHICAGO
BLAKE 30 CHICAGO
CLARK 10 NEW YORK
SCOTT 20 DALLAS
THE 10 NEW YORK KING
TURNER 30 CHICAGO
20 DALLAS ADAMS
JAMES 30 CHICAGO
FORD 20 DALLAS
MILLER 10 NEW YORK
40 BOSTON
15 selected lines
-----------------------------------------------------------------------------------------------------------------------------
SQL > SELECT E.ENAME,.
2 D.DEPTNO,
3 D.LOC
4. TO EMP E
5 LEFT OUTER JOIN
D 6 DEPT
7. THE E.DEPTNO = D.DEPTNO;
ENAME, DEPTNO LOC
---------- ------ -------------
MILLER 10 NEW YORK
THE 10 NEW YORK KING
CLARK 10 NEW YORK
FORD 20 DALLAS
20 DALLAS ADAMS
SCOTT 20 DALLAS
20 DALLAS JONES
DALLAS SMITH 20
JAMES 30 CHICAGO
TURNER 30 CHICAGO
BLAKE 30 CHICAGO
MARTIN 30 CHICAGO
WARD 30 CHICAGO
ALLEN 30 CHICAGO
14 selected lines
My doubt is both are same query is the same, is in ansi format and is in the format of the Oracle,.
but the results are different.
For the first query null is coming for unmatched records in the dept table
but in the second query, it does not come
Thank you
Hello
2947022 wrote:
Hi all
I use under version
Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0
SQL > SELECT E.ENAME,.
2 D.DEPTNO,
3 D.LOC
4. TO EMP E,.
DEPT 5 D
6. WHERE = E.DEPTNO D.DEPTNO (+);
ENAME, DEPTNO LOC
---------- ------ -------------
DALLAS SMITH 20
ALLEN 30 CHICAGO
WARD 30 CHICAGO
20 DALLAS JONES
MARTIN 30 CHICAGO
BLAKE 30 CHICAGO
CLARK 10 NEW YORK
SCOTT 20 DALLAS
THE 10 NEW YORK KING
TURNER 30 CHICAGO
20 DALLAS ADAMS
JAMES 30 CHICAGO
FORD 20 DALLAS
MILLER 10 NEW YORK
40 BOSTON
15 selected lines
-----------------------------------------------------------------------------------------------------------------------------
SQL > SELECT E.ENAME,.
2 D.DEPTNO,
3 D.LOC
4. TO EMP E
5 LEFT OUTER JOIN
D 6 DEPT
7. THE E.DEPTNO = D.DEPTNO;
ENAME, DEPTNO LOC
---------- ------ -------------
MILLER 10 NEW YORK
THE 10 NEW YORK KING
CLARK 10 NEW YORK
FORD 20 DALLAS
20 DALLAS ADAMS
SCOTT 20 DALLAS
20 DALLAS JONES
DALLAS SMITH 20
JAMES 30 CHICAGO
TURNER 30 CHICAGO
BLAKE 30 CHICAGO
MARTIN 30 CHICAGO
WARD 30 CHICAGO
ALLEN 30 CHICAGO
14 selected lines
My doubt is both are same query is the same, is in ansi format and is in the format of the Oracle,.
but the results are different.
For the first query null is coming for unmatched records in the dept table
but in the second query, it does not come
Thank you
In fact, these requests are not the same.
The first is to find all the lines of the Department, with the corresponding lines of PGE (when there are). This is equivalent to «FROM dept LEFT OUTER JOIN emp...» ».
The second is to find all the rows in the emp of the lines of the Department (when there are any). This is equivalent to «...» WHERE e.deptno = d.deptno (+).
-
Hi, I have a problem with my query:
SELECT t1.step, t2.name FROM RIGHT JOIN t1 t2 ON t2.step = t1.step
I have two tables, small t1 and t2 great.
table T1 (7 lines):
name of the step
1 a
2B
3 C
4 D
5 e
$4
7 g
table T2 (10000 lines);
name of the step ID
100 1A
101 2B
102 3 c
103 4 D
104 5th
105 1A
106 2 b
107 3 c
108 d 4
109 5 e
110 1A
111 2B
112 3 c
113 4 D
114 5 e
115 1A
116 2B
117 c 3
118 d 4
119 5th
… … ..
I want external right to join them, and have values in t2.name NULL and the range of steps (1-7).
My query returns this:
name of the step
1 a
2B
3 C
4 D
5 e
1 a
2B
3 C
4 D
5 e
1 a
2B
3 C
4 D
5 e
....
Thank you.
So there is indeed a key score in T2, it is "ROW_NR", and we can do this:
select t1.col_nr , t2.row_nr , t1.sheet_name , t1.cell , t1.column_name , t2.string_val from t1 left outer join t2 partition by (t2.row_nr) on t2.col_nr = t1.col_nr ;
Maybe you are looking for
-
Does anyone else have trouble with the life of the battery with iOS 10? I have a 5 c and I charge my iphone once per day if that. Now its hollow when I get up morning so I charge it at work and also I have to recharge at night. I need this so becaus
-
Where is the frigin toolbar in firefox mobile?
How can you us HELLO on their cell phones if the stupid button cannot be installed?Very frustrating.DON
-
How can I get these permissions
Hello! So, I recently updated my computer at El Capitan and since then I noticed that I lost many of my computer's system files permissions. I can access the files and read them, but I can't write, before you tell me to click on get info, I assure yo
-
I tried to clear the cache and delete cookies from gmail, but none worked. I can access gmail from my phone and through IE but not firefox. I also use the gmail gadget to my igoogle page and it does not work either.
-
Recovery of product without Norton AV?
Satellite A100-049, Vista Home Premium. Recently purchased this laptop works very well, except that I can't get rid of leftovers from Norton AV (quite a common problem, I understand), despite the execution of the program available on the Symantec sit