SELECT
HEADER_ID
FROM
XXCORP.XXCORP_OM_DEALER_FEE_DIS_HDR as h,
XXCORP.XXCORP_OM_DEALER_FEE_DIS_LIN,
OE_ORDER_HEADERS_ALL
WHERE h.FEE_ID = XXCORP_OM_DEALER_FEE_DIS_LIN.FEE_ID (+)
AND h.HEADER_ID(+) = OE_ORDER_HEADERS_ALL.HEADER_ID
AND (XXCORP.XXCORP_OM_DEALER_FEE_DIS_LIN.LAST_UPDATE_DATE > TO_DATE('03/10/2019 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
Asked
Active
Viewed 89 times
0
-
9Tip of today: Switch to modern, explicit `JOIN` syntax. Easier to write (without errors), easier to read (and maintain), and easier to convert to outer join if needed. – jarlh Mar 12 '19 at 20:27
-
In addition what jarlh wrote: even Oracle recommends to stop using the proprietary `(+)` operator – Mar 12 '19 at 20:30
-
I'm sure there are better ways to write this query. Please provide sample data, desired results, and an explanation of what the logic is supposed to be doing. – Gordon Linoff Mar 12 '19 at 20:30
-
@jarlh, *= much better. – M.N. Mar 12 '19 at 21:10
1 Answers
0
Table name shouldn't have AS
for the alias, here:
XXCORP.XXCORP_OM_DEALER_FEE_DIS_HDR as h,
--
this! --> remove "as"
Example which illustrates it:
SQL> select * From dept as d;
select * From dept as d
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
SQL> select * from dept d;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL>

Littlefoot
- 131,892
- 15
- 35
- 57
-
it worked also i needed to give alias.HEADER_ID in the select statement – SRBman Mar 12 '19 at 20:43
-
Yes, if it is contained in more than one table (as Oracle doesn't know which one to take). – Littlefoot Mar 12 '19 at 20:48