SQL Oracle LEFT JOIN and SUBQUERY error: ORA-00905: missing keyword
In Oracle we don't include the AS
when declaring a table alias. Instead of
) AS TABLE_RESOLVERS
write
) TABLE_RESOLVERS
This is one example when Oracle syntax is more restrictive than some other flavours of SQL. It is also inconsistent with the declaration of column aliases, which is unfortunate but almost certainly it's too complex to change this far down the road.
SQL Developer doesn't recognize right outer join ORA-00905: missing keyword
Wrong syntax. Try something like this:
select r.*, s.att1, s.att2, s.att3, s.att4
from shell s right outer join route r
Missing Keyword Error - Join Subquery with Oracle
This portion does not make sense:
(SELECT CUST_NO,
MIN(CUST_CDE) AS CUSTOMER_CODE
FROM SCHEMA.TABLE2
GROUP BY CUST_NO
) SCHEMA.TABLE2 T2
It looks like you are giving two aliases to the subquery. But the first one isn't valid.
Your code could have other problems, but try removing the SCHEMA.TABLE2
after the )
. I presume you want:
(SELECT CUST_NO,
MIN(CUST_CDE) AS CUSTOMER_CODE
FROM SCHEMA.TABLE2
GROUP BY CUST_NO
) T2
SQL Oracle Error: ORA-00905: missing keyword
The error with what you posted is that the subquery has a group by clause but no aggregate such as sum(), count(), etc. In other words, this is not valid:
select x, y
from table2
group by x, y
Maybe you want
select distinct x, y
from table2
ORA-00905: missing keyword error oracle
The most likely issue is MJNSXJJRW AS S0
. You use the AS
keyword when defining column aliases, not when defining table aliases.
CREATE VIEW MJNSXJJRW_view AS
SELECT B.oID AS "_oid", B.oTm AS "_otm"
FROM
(SELECT DISTINCT oID, oTm FROM MJNSXJJRW) B
LEFT JOIN MJNSXJJRW S0 ON
B.oID = S0.oID AND
S0.idx = 0 AND
S0.kID = "str_val" ;
I'm assuming that "str_val"
is a column, not a string literal. If it's the latter you should use single quotes.
Missing Keyword in JOIN syntax
You have JOIN
-WHERE
-ON
sequence which is wrong.
Should be something like this (assuming WHERE
is not a part of your joining condition):
FROM employees e
JOIN jobs j ON e.job_id = j.job_id
....
....
WHERE e.salary >
(SELECT AVG(salary) FROM employees WHERE job_id LIKE '%CLERK%')
ORDER BY ...
Related Topics
How to View All the Metadata of Columns of a Table in Oracle Database
SQL Coalesce with Empty String
Recursive Stored Functions in MySQL
Entity Framework Hitting 2100 Parameter Limit
Select Only Some Columns from a Table on a Join
Is the 'As' Keyword Required in Oracle to Define an Alias
Meaning of "Select Tables Optimized Away" in MySQL Explain Plan
Deleting Duplicates Rows from Redshift
Using Table Variable with Sp_Executesql
How to Find the Number of Occurrences of a Particular Character in a String Using SQL
Sql: Select Most Recent Date for Each Category
How to Grant All Privileges on Views to Arbitrary User
SQL Use Case Statement in Where in Clause
Can the "In" Operator Use Like-Wildcards (%) in Oracle
SQL - Displaying Entries That Are the Max of a Count
SQL Server as Statement Aliased Column Within Where Statement