I am very new to Oracle, i am developing a query to my project. For me it seems to be everything is OK but when executing the query oracle is giving the error “ORA-00905: missing keyword”.
Her is my query::
SELECT DISTINCT ba.uuid AS uuid
, COUNT(*) over() AS rowcount
FROM basicaddress ba
WHERE ba.postalcode='143456'
OR ba.lastname LIKE '%143456%'
OR ba.city LIKE '%143456%'
GROUP BY CASE WHEN ba.postalcode='143456' THEN ba.postalcode, ba.uuid END
, CASE WHEN ba.lastname LIKE '%143456%' THEN ba.lastname, ba.uuid END
, CASE WHEN ba.city LIKE '%143456%' THEN ba.city, ba.uuid
ELSE ba.postalcode,ba.uuid END
ORDER BY CASE WHEN ba.postalcode='143456' THEN ba.postalcode END DESC
, CASE WHEN ba.lastname LIKE '%143456%' THEN ba.lastname END ASC
, CASE WHEN ba.city LIKE '%143456%' THEN ba.city ASC
ELSE ba.postalcode END DESC
What Key word i am missing ? Any help will be greatly appreciated.
The error is in your
CASEstatementsYou have to decide between
ba.postalcodeandba.uuid. Or, if you want to see values of both columns in your final result set concatenate them using || operator or CONCAT function using implicit or explicit type conversion.