outer join with syntax plus sign
To do this in Sql outer joins can be used as grammar:( + )
What are the standards (ISO, ANSI and what version) created this grammar?
Or is it only the invention of Oracle?
Published by: CharlesRoos on July 1st, 2010 07:23
Apparently, he was "there are chandeliers" ;)
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2419891400346921578 #2439016200346544570
Tags: Database
Similar Questions
-
Dear elders,
Firstly, sorry if my question is considered to be 'very novice' but I have this problem of confusion.
Can I use the left outer join with summary?
For example:
Work table
Table No.JobCode JobGroupCode 111A 1100 112B 1100 113C 1100 121A 1200 333F 3300
Activity tableJobGroupCode ParentCode 1100 1000 1200 1000 1300 1000 3300 3000
I want to choose with this resultJobcode Mandays 111A 5 112B 7 113C 3
All I did was:Job.JobCode Job.JobGroupCode JobGroup.Parentcode Mandays 111A 1100 1000 5 112B 1100 1000 7 113C 1100 1000 3 121A 1200 1000 0 333F 3300 3000 0
and I got was only jobcode activity table, not exactly what I want to get all the work table jobcode. Could you please tell me, where I was wrong?select j.jobcode, j.jobgroupcode, jg.parentcode, sum(a.mandays) from job j inner join jobgroup jg on j.jobgroupcode = jg.jobgroupcode left join activity a on j.jobcode = a.jobcode group by j.jobcode, j.jobgroupcode, jg.parentcode
result
Thank you very much.Job.JobCode Job.JobGroupCode JobGroup.Parentcode Mandays 111A 1100 1000 5 112B 1100 1000 7 113C 1100 1000 3
Published by: user11197113 on May 25, 2009 03:31
Published by: user11197113 on May 25, 2009 03:32Hello (and welcome!).
Edit
OK, try this:
select j.jobcode, j.jobgroupcode, jg.parentcode, NVL(sum(a.mandays),0) from job j inner join jobgroup jg on j.jobgroupcode = jg.jobgroupcode left join activity a on j.jobcode = a.jobcode group by j.jobcode, j.jobgroupcode, jg.parentcode
That will give you this:
JOBC JOBG PARE SUM(A.MANDAYS) ---- ---- ---- -------------- 111A 1100 1000 5 112B 1100 1000 7 113C 1100 1000 3 121A 1200 1000 0 333F 3300 3000 0
These are real results of your test data.
-
Hi, I am new to oracle and I worked this request for reports for about 2 weeks, please take a look at my request
null values is on the mtl_material_transactions table, which is reason_id, subinventory_code and transaction_referenceSELECT mmt.transaction_date "Transaction Date", msib.segment1 "Item", gcc.segment1||'-'||gcc.segment2||'-'||gcc.segment3||'-'||gcc.segment4||'-'||gcc.segment5||'-'||gcc.segment6||'-'||(nvl(gcc.segment7,'000000')) "account", (CASE mttype.transaction_type_name WHEN 'Average cost update' THEN ((nvl(mmt.new_cost,0) - nvl(mmt.prior_cost,0)) * nvl(mmt.quantity_adjusted,0)) + nvl(mmt.variance_amount,0) ELSE (mmt.Primary_quantity * nvl(mmt.actual_cost, 0) + nvl(mmt.variance_amount, 0)) END) "Transaction Value", mttype.description "Transaction Type", mmt.subinventory_code "Subinventory", ood.organization_code "Org", msib.Primary_UOM_Code "UOM", mmt.Primary_Quantity "Primary Quantity", mtr.description "Reason", mmt.transaction_reference "Reference" FROM mtl_material_transactions mmt, mtl_system_items_b msib, mtl_transaction_accounts mta, gl_code_combinations gcc, mtl_transaction_types mttype, Org_Organization_Definitions ood, mtl_transaction_reasons mtr WHERE mmt.transaction_date >= :P_DATE_FROM and mmt.transaction_date < :P_DATE_TO +1 and mmt.organization_id = :P_ORGANIZATION and msib.organization_ID = mmt.organization_ID and msib.inventory_item_id=mmt.inventory_item_id and mta.transaction_id=mmt.transaction_id and gcc.code_combination_id = mta.reference_account and mttype.transaction_type_id=mmt.transaction_type_id and mmt.reason_id=mtr.reason_id(+) and ood.organization_id=mmt.organization_id and mttype.transaction_type_id = :P_TRANSACTION_TYPE and msib.segment1 = :P_ITEM AND gcc.segment2 = :P_ACCOUNT
put desired option on would show all archives on mtl_material_transactions with null values
so I put the symbol of the outer join right?
BTW
I tried to put the (+) sign on various locations but it still not good and I am really at a lossHello
Whenever you have any questions, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and the desired results from these data. I know that's not always easy, but it is really necessary. Compounds that, I do not understand your problem.
It could be useful that simplify you the problem. If you were not interested in, say, the mta, gcc, tables msib and ood, would you still have the same problem? If so, forget all these tables and just after, CREATE TABLE and INSERT statements for the remaining tables and the results you want from this data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.The query you posted will not exclude any line of mmt just because it doesn't have a corresponding line in the mtr; That's what the condition:
and mmt.reason_id=mtr.reason_id(+)
but it will exclude mmt lines if they do not have matching rows in other tables. Maybe you need + plus join and may under certain conditions non-join, such as conditions
gcc.segment2 (+) = :P_ACCOUNT
Too much. It's just a guess. Without seeing your sample data and the correct results, you should get from this data, I can't say.
-
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.
-
Why can't I just open a new tab with the "Plus" sign or "command-T"?
If I want to open a new tab, I either press 'Command T' or select 'New tab' in the file menu, or click on the little "plus" sign in my tab bar - right? None of them work. What Miss me?
This problem is Firefox on your Mac?
Perhaps users have discovered that this problem is caused by led modules, for example a plugin Conduit and/or an extension "Community Toolbar".
You can check and disable the extensions on page modules. Either:
- Command + shift + a
- "3-bar" menu button (or tools) > Add-ons
In the left column, click Extensions. Then, when in doubt, turn off.
Often, a link will appear above at least an extension disabled to restart Firefox. You can complete your work on the tab and click one of the links in the last step.
What helps with the button "+"? If so, you can name the specific extension that caused the problem?
You can also see the Plugins page modules. You can never use 'activate' to disable plugins that you do not usually use.
-
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.
-
Why left outer join with a table gives me more lines?
Hi gurus,
I can see "view_a" and a table 'table_a '.
view_a a county of 100 lines. Now, when I left outer join that discovers with a 'table_a', I expect all 100 lines.
However, I'm more than 100 lines. Is it still possible?
Also even to analyze these situations, how can I move forward?
Because it is very high volumn of sight and takes longer to run.
Select count (*) view_a, view_b
where view_a.col1 = view_b.col1 (+)
and view_a.col2 = view_b.col2 (+);
Thank you
I can see "view_a" and a table 'table_a '.
view_a a county of 100 lines. Now, when I left outer join that discovers with a 'table_a', I expect all 100 lines.
However, I'm more than 100 lines. Is it still possible?
Also even to analyze these situations, how can I move forward?
Because it is very high volumn of sight and takes longer to run.
Select count (*) view_a, view_b
where view_a.col1 = view_b.col1 (+)
and view_a.col2 = view_b.col2 (+);
Which is not necessarily related to the use of an outer join.
Just join of two tables in general will give you more rows of one table has.
Scott DEPT table contains ONE row for deptno = 10
The EMP table has THREE rows of deptno = 10
The number of rows you plan if you join two tables using an equi-join?
Three - what is MORE lines the DEPT table has for deptno = 10
Select * from Department where deptno = 10
DEPTNO, DNAME, LOC
10, ACCOUNTING, NEW YORKSelect * from emp where deptno = 10
MGR, EMPLOYMENT ENAME, EMPNO, HIREDATE, SAL, COMM, DEPTNO
7782, CLARK, MANAGER, 7839, 6/9/1981,2450, 10
7839, KING, PRESIDENT, 17 NOVEMBER 00, 10
7934, MILLER, CLERK, 7782, 23 JANUARY 00: 10Select dept.*, emp.*
Department, emp
where dept.deptno = 10
and dept.deptno = emp.deptnoDEPTNO, DNAME, LOC, EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO_1
10, ACCOUNTING, NEW YORK, 7782, CLARK, MANAGER, 7839, 6/9/1981,2450, 10
10, ACCOUNTING, NEW YORK, 7839, KING, PRESIDENT, 17 NOVEMBER 00, 10
10, ACCOUNTING, NEW YORK, 7934, MILLER, CLERK, 7782, 23 JANUARY 00: 10So if these are the lines ONLY in the table EMP and DEPT the query would give you THREE lines despite the DEPT table only ONE line.
No do you expect? You get ALL the child rows that belong to the parent company. Otherwise, how could it possibly work?
The OUTER join includes lines where the parent row exists but there is NO child line as others have shown.
Outer joins
Outer join extends the result of a simple join. Outer join returns all rows that satisfy the join condition and also returns some or all rows in a table for which no line of the other meet the join condition.
Get more lines to exist in one of the paintings is a basic necessity. It usually has NOTHING to with the question of whether you have an outside to join or not.
See the section on the JOINTS in the Oracle documentation
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/queries006.htm
-
outer join with the additional constraint
Hello
With the help of Oracle 11 g R2.
I would of outer join tables 2 together and put down restrictions on the types of records that are returned in the query result. Here's a mock-up of the tables and data.
create table aaa (col1 number not null, col2 number not null)
create table bbb (col1 number not null, col2 number not null)
insert into values of aaa (1: 80)
insert into values aaa (2, 90)
insert into values aaa (3, 80)
insert into values aaa (4, 90)
insert into values aaa (5, 80)
insert into bbb values (3, 600)insert into values of bbb (4, 700)
This is the query
select a.col1, a.col2, b.col1, b.col2 from aaa a, bbb b where a.col1 = b.col1 (+) and (a.col2, b.col2) <> ((90, 700))
The result of the query is as follows.
col1 col1 col2 col2
1 80
3 80 3 600
5 80
Where col1 = 4 has been deleted, which is an expected result. However, where col1 = 2 has also been removed, which is not a desired outcome. Your response is appreciated.
Hello
Here is a way that works for the given sample data:
SELECT *.
AAA a
LEFT OUTER JOIN bbb b ON a.col1 = b.col1
WHERE the NVL (a.col2, 0) <> 90
OR NVL (b.col2, 0) <> 700
;
I don't know if that will satisfy your requirements with other data, since you didn't say what your needs are.
Whenever you have a WHERE clause is applied after the outer join, all columns of the table in option (table bbb in this example) must be used in an NVL, NVL2 or something like a CASE expression that takes into account null values; otherwise, the effect will be the same as an inner join.
-
Using Left Outer Join with reference
I have three tables.
Table 1: BOOK_DETAILS
Fields: BOOK_ID, BOOK_NAME
Table 2: BOOK_ISSUE_RECORD
Fields: BOOK_ID, USER_NAME
Table 3: BOOK_AUTHOR
Fields: BOOK_ID, AUTHOR_NAME
I must link table 1 and table 2 with a left outer join, because even if the book is not the questions to anyone, his name should come.
I have once again display the name of the author of books for each book.
I am able to create a query with the left outer join between table 1 and table 2. However, I am not able to give a reference to Table 3.
Can someone help me with this please.
Concerning
Hawkerselect d.book_name, a.book_author, i.user_name from book_details d join book_author a on (d.book_id = a.book_id) left join book_issue_recors i on (d.book_id = i.book_id) /
SY.
-
Outer join when made between the columns of the two tables is easy to understand and I'm familiar with it. But when it comes to the same join with a constant, my head starts spinning... you guys can help me with this? I would appreciate that show you with examples.
Thanks a ton.Hello
>
Ok... I want to understand the output of the last sql statement given here.
...
Select * from a, b
where col_a (+) = col_b
and col_a (+) = 1It shows put it is as follows
col_a, col_b
1 1
2 NULL
NULL NULLJoining means: 'display all rows in table b and the corresponding rows in the table one '.
Since it is an outer join, it also means "view b lines even if there is no corresponding row in a.Thus, the output contains 3 lines, which correspond to the 3 lines in b.
Only one of them (the one with col_b = 1) had a game in a.col_a, if the column is NULL in the other lines.With the sample data you posted, you will get the same results without condition
and col_a (+) = 1
If you want to understand what makes this condition, use some examples of data where this condition would fail.
For example, add this line to the table a:insert into a values (2);
and run your original query (including the)
and col_a (+) = 1
). what output you get? You get the same exact results you did without the new line in a.
In other words, the b line where col_b = 2 has still no matches in the table has.
True, there is now a line of table where col_a = 2, but which does not constitute a game. A match is defined by two conditions:where col_a (+) = col_b and col_a (+) = 1
in order to have a pair of lines which meets only the first condition
where col_a (+) = col_b
is not enough.
-
Hello
We have this basic question that works very well:
Select pp.upc, a.barcode from the ALBUM, PHYSICALPRODUCT RP where lpad (pp.upc, 13, '0') = lpad (a.barcode, 13, '0')
But we wanted to do an outer join. If we remove the lpad, it works. But if we as below, we have ORA-00936, lack of expression:
Select pp.upc, a.barcode from the ALBUM, PHYSICALPRODUCT RP where lpad (pp.upc, 13, '0') (+) = lpad (a.barcode, 13, '0')
If anyone can help us in this regard.
Thks.Outer join can be used outside the functions of text
It will be likeselect pp.upc, a.barcode from ALBUM a, PHYSICALPRODUCT pp where lpad(pp.upc (+), 13, '0') = lpad(a.barcode, 13, '0')
-
Alrighty, the Firefox on my laptop (und such that she has always been with Firefox for me) has the "Open a new tab" button as a tab himself. Always to the right of the tabs I have open und is smaller with only one more sign on this subject. (+) I hit that, bam, a new tab page opens upward, always with the + page to the right to open another tab, if I want to.
Yet, on the desktop that I use currently, this option isn't here. Instead, Open a button tab is a real personal touch I can move it anywhere near the bar of the browser, much as I have with the: start a conversation, current downloads, bookmark, home, options, privacy, etc... buttons.
I like the feature to open a new tab with Firefox on my laptop but not on my desktop. However, I can't find anything on how to open a new tab appears with the real tablets themselves where it is conveniently next to the tab I'm on that, rather than being a button where I have to go to one side or the other of my screen to get a new tab to open...
How do I change it?
The image I have uploaded, 'B', this is what is on my desk, 'A' is what is on my laptop. "A" is what I want on my desktop.
Don't know what you're going with "expected normal behavior." I was asking how to pass from one to the other, in this case 'B' to 'A' in regards to my image is concerned. But, in any case, go out of your first line "the new tab button displays a button"+"when the button is on the tab bar", it's answered my question without answering it directly.
I asked how to get from one to the other, I know that both are possible. Which... answer my question would have been:
Just drag the new customizable tab to the tabs above button, not the toolbar with the browser bar, etc. below.
Behavior is not what I was asking, I was wondering how to change from one to the other. But thanks, move the button to the top with the tabs is what has changed for me in what I wanted.
-
BAD RESULTS WITH OUTER JOINS AND TABLES WITH A CHECK CONSTRAINT
HII All,
Could any such a me when we encounter this bug? Please help me with a simple example so that I can search for them in my PB.
Bug:-8447623
Bug / / Desc: BAD RESULTS WITH OUTER JOINS AND TABLES WITH a CHECK CONSTRAINT
I ran the outer joins with check queries constraint 11G 11.1.0.7.0 and 10 g 2, but the result is the same. Need to know the scenario where I will face this bug of your experts and people who have already experienced this bug.
Version: -.
SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for Solaris: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production
Why do you not use the description of the bug test case in Metalink (we obviously can't post it here because it would violate the copyright of Metalink)? Your test case is not a candidate for the elimination of the join, so he did not have the bug.
Have you really read the description of the bug in Metalink rather than just looking at the title of the bug? The bug itself is quite clear that a query plan that involves the elimination of the join is a necessary condition. The title of bug nothing will never tell the whole story.
If you try to work through a few tens of thousands of bugs in 11.1.0.7, of which many are not published, trying to determine whether your application would be affected by the bug? Wouldn't be order of magnitude easier to upgrade the application to 11.1.0.7 in a test environment and test the application to see what, if anything, breaks? Understand that the vast majority of the problems that people experience during an upgrade are not the result of bugs - they are the result of changes in behaviour documented as changes in query plans. And among those who encounter bugs, a relatively large fraction of the new variety. Even if you have completed the Herculean task of verifying each bug on your code base, which would not significantly easier upgrade. In addition, at the time wherever you actually performed this analysis, Oracle reportedly released 3 or 4 new versions.
And at this stage would be unwise to consider an upgrade to 11.2?
Justin
-
[8i] need help with full outer join combined with a cross join...
I can't understand how to combine a full outer join with a different type of join... is it possible?
Here are some create table and insert for examples of database:
And, the results that I want to get:CREATE TABLE my_tab1 ( record_id NUMBER NOT NULL , workstation VARCHAR2(4) , my_value NUMBER CONSTRAINT my_tab1_pk PRIMARY KEY (record_id) ); INSERT INTO my_tab1 VALUES(1,'ABCD',10); INSERT INTO my_tab1 VALUES(2,'ABCD',15); INSERT INTO my_tab1 VALUES(3,'ABCD',5); INSERT INTO my_tab1 VALUES(4,'A123',5); INSERT INTO my_tab1 VALUES(5,'A123',10); INSERT INTO my_tab1 VALUES(6,'A123',20); INSERT INTO my_tab1 VALUES(7,'????',5); CREATE TABLE my_tab2 ( workstation VARCHAR2(4) , wkstn_name VARCHAR2(20) CONSTRAINT my_tab2_pk PRIMARY KEY (workstation) ); INSERT INTO my_tab2 VALUES('ABCD','WKSTN 1'); INSERT INTO my_tab2 VALUES('A123','WKSTN 2'); INSERT INTO my_tab2 VALUES('B456','WKSTN 3'); CREATE TABLE my_tab3 ( my_nbr1 NUMBER , my_nbr2 NUMBER ); INSERT INTO my_tab3 VALUES(1,2); INSERT INTO my_tab3 VALUES(2,3); INSERT INTO my_tab3 VALUES(3,4);
I tried a number of different things, google my problem and no luck yet...workstation sum(my_value) wkstn_name my_nbr1 my_nbr2 --------------------------------------------------------------- ABCD 30 WKSTN 1 1 2 ABCD 30 WKSTN 1 2 3 ABCD 30 WKSTN 1 3 4 A123 35 WKSTN 2 1 2 A123 35 WKSTN 2 2 3 A123 35 WKSTN 2 3 4 B456 0 WKSTN 3 1 2 B456 0 WKSTN 3 2 3 B456 0 WKSTN 3 3 4 ???? 5 NULL 1 2 ???? 5 NULL 2 3 ???? 5 NULL 3 4
So, what I want, it's a full outer join of t1 and t2 on workstation and a cross join of one with the t3. I wonder if I can't find examples of it online because it is not possible...SELECT t1.workstation , SUM(t1.my_value) , t2.wkstn_name , t3.my_nbr1 , t3.my_nbr2 FROM my_tab1 t1 , my_tab2 t2 , my_tab3 t3 ...
Note: I'm stuck dealing with Oracle 8i
Thank you!!Hello
The query I posted yesterday is a little more complex that it should be.
My_tab2.workstation is unique, there is no reason to make a separate subquery as mt1. We can join my_tab1 to my_tab2 and get the SUM in a subquery.SELECT foj.workstation , foj.sum_my_value , foj.wkstn_name , mt3.my_nbr1 , mt3.my_nbr2 FROM ( -- Begin in-line view foj for full outer join SELECT mt1.workstation , SUM (mt1.my_value) AS sum_my_value , mt2.wkstn_name FROM my_tab1 mt1 , my_tab2 mt2 WHERE mt1.workstation = mt2.workstation (+) GROUP BY mt1.workstation , mt2.wkstn_name -- UNION ALL -- SELECT workstation , 0 AS sum_my_value , wkstn_name FROM my_tab2 WHERE workstation NOT IN ( -- Begin NOT IN sub-query SELECT workstation FROM my_tab1 WHERE workstation IS NOT NULL ) -- End NOT IN sub-query ) foj -- End in-line view foj for full outer join , my_tab3 mt3 ORDER BY foj.wkstn_name , foj.workstation , mt3.my_nbr1 , mt3.my_nbr2 ;
Thanks for posting the CREATE TABLE and INSERT statements, and very clear expected results!
user11033437 wrote:
... So, what I want, it's a full outer join of t1 and t2 on workstation and a cross join of one with the t3.She, exactly!
The trickiest part is when and how get SUM (my_value). You could address the question of exactly what my_tab3 must be attached to a cross that's exactly what should look like the result set of the full outer join between my_tab1 and my_tab2 to. To do this, take your desired results, remove columns that do not come from the outer join complete and delete duplicate rows. You will get:workstation sum(my_value) wkstn_name ----------- ------------- ---------- ABCD 30 WKSTN 1 A123 35 WKSTN 2 B456 0 WKSTN 3 ???? 5 NULL
So the heart of the problem is how to get these results of my_tab1 and my_tab2, which is done in the subquery FOJ above.
I tried to use auto-documenté in my code names. I hope you can understand.
I could spend hours explaining the different parts of this query more in detail, but I don't know that I would lose some of that time, explain things that you already understand. If you want an explanation of the specific element (s), let me know. -
Oracle 10g
I have three below queries that use the outer join syntax.
All three queries return exactly the same results
(a)
(b)SELECT TA.ID TA , TB.ID TB FROM TA , TB WHERE TA.ID = TB.ID(+);
(c)SELECT TA.ID TA , TB.ID TB FROM TA , TB WHERE TB.ID(+) = TA.ID;
I have the right call outer join query because the (+) sign is located on the right and outer join query (b) left because the (+) sign is on the left?SELECT TA.ID TA , TB.ID TB FROM TA LEFT OUTER JOIN TB ON TA.ID = TB.ID;
Or is the left join or right determined by the join columns specified in the order select it?
Create the Script
BenCREATE TABLE TA ( "ID" NUMBER ); CREATE TABLE TB ( "ID" NUMBER ); INSERT INTO TA (ID) VALUES ('1'); INSERT INTO TA (ID) VALUES ('2'); INSERT INTO TA (ID) VALUES ('3'); INSERT INTO TB (ID) VALUES ('1'); INSERT INTO TB (ID) VALUES ('2'); INSERT INTO TB (ID) VALUES ('4');
Published by: benton on August 15, 2012 08:16Hi, Ben.
Benton says:
... So is it correct to say that the left or right refers to which side the null values will be displayed?Lol it is incorrect to say that the old syntax outer join (using the sign +) is either a left - or a right outer join.
... So I need to have the order of the columns in the correct SELECTION so that there is no likelihood of confusion over which side will display NULL values. If I place the columns A and B in the wrong order, that is to say B then a I'll lend to confusion about what will be returned with respect whether left or right.
No, do not hesitate to organize columns in the select in any way will help your users the most. What is happening in the FROM and WHERE clause, in particular the order in which the tables happens to appear, may not have something to do with the order of the columns in the output.
Many readers are more comfotable with having NULL columns at the end of a line of output, or at least not at the beginning, so maybe it's one of the reasons for ta.id first in your example. Rearrange the columns in the game any way more than makes sense for people who will look at them.
Maybe you are looking for
-
Windows KB2761465 update keeps repeating
The update of Windows KB2761465 for IE8 continues to repeat every time I restart, even if it has already been downloaded and installed. How can I fix this? Thank you.
-
The upgrade of the Belvedere 6.2 and 6.5
If I upgrade my Lookout 6.2 to 6.5 server which is also the same machine is my Web Player folder, clients running always drive Web 6.2 will be able to run the process file new 6.5 in my folder of drive on the server?
-
Hide notifications does not, I bought win7 at the beginning of this year, so I'm not going to change OS on this machine, every day I select this option to hide the notification of win10, and every day he comes back, can he be permanently hidden? (I t
-
Authenticate on the Member Server external windowsdb
I would like to know if someone was able to get the version of camera ACS to authenticate users on a Windows Member Server not a domain controller (no advertising).
-
Windows 7 computers lose trust with the domain.
Windows 7 computers lose trust with the domain. I need one real trouble other than a work around. My computer Windows XP are very good. I have to update my domain controller? I have remove the field and re-add-the computers throughout the day. I