I have an existing large enterprise application that we are converting the database from MySQL to Oracle for various reasons. We've got hundreds of current MySQL commands working inside Oracle without much hassle, except for one. The following SQL executes on MySQL without any issues:
SELECT `user_id`, `shift_type`, `date`, COUNT(*) as c
FROM `staff`
WHERE `date` = '2020-02-02' AND `shift_type` != 'oncall'
GROUP BY user_id, shift_type, date
HAVING c > 1
This executes and gives us the results of any staff who exist more than once for a given date with the criteria above. But running that same SQL query in Oracle, with the apostrophes removed (as required by Oracle), we get a Error Message : ORA-00936: missing expression. This is the exact Oracle SQL I tried:
SELECT user_id, shift_type, date, COUNT(*) as c
FROM staff
WHERE date = '2020-02-02' AND shift_type != 'oncall'
GROUP BY user_id, shift_type, date
HAVING c > 1
I've checked lots of other Stack Overflow answers about this error code. Most refer to removing an extra comma. I've tried that on various parts above, but nothing seems to work. Really hoping someone here is able to help point me in the right direction.