cerebalbore
Technical User
Hi,
I have an old query (not written by me) which is running against an oracle database, but I get the error "FROM not found where expected". The from looks to me like it is in the right place!
I am not used to Oracle, but am ok with SQL. I am using MS Query because I don't know any other way of looking at the data.
Here's the query (I've tried to make it easier to read):
SELECT ee_empno, ee_title || ' ' || ee_inits || ' ' || ee_sname name, ee_dept, ee_company, ee_hol_enttlment + eels_carry_fwd hol_entitlement, ee_hol_taken,sum(decode(SIGN(to_char (msa_date, 'DDD') - to_char (sysdate, 'DDD')), -1, decode(msa_duration, -3, 1, 0.5), 0)) total_hol_taken,
sum(decode(msa_duration, -3, 1, 0.5)) total_hol_booked
FROM eels, msa, ms, ee
WHERE eels.eels_year + 1 = 2010
AND msa_date = ms_date
AND ms_ds_std_day <> '0'
AND ee_empno = msa_empno
AND (ee_lvdate is Null)
AND to_char (msa_date, 'YYYY') = 2010
AND msa_timecode = '300'
AND ms_empno = ee_empno
GROUP BY ee_empno, ee_title || ' ' || ee_inits || ' ' || ee_sname, ee_dept, ee_company, ee_hol_enttlment + eels_carry_fwd, ee_hol_taken
ORDER BY ee_empno, ee_dept
I have tried to Google but the only thing I have found is that using reserved keywords in the wrong place could throw errors. The only keyword I can see in this query is 'sysdate', and if I try to replace that with a subquery (SELECT sysdate FROM DUAL) it them tells me it cannot add the table ''DDD'))'.
Any help would be appreciated.
Thanks
Kat
I'm such a noob
I have an old query (not written by me) which is running against an oracle database, but I get the error "FROM not found where expected". The from looks to me like it is in the right place!
I am not used to Oracle, but am ok with SQL. I am using MS Query because I don't know any other way of looking at the data.
Here's the query (I've tried to make it easier to read):
SELECT ee_empno, ee_title || ' ' || ee_inits || ' ' || ee_sname name, ee_dept, ee_company, ee_hol_enttlment + eels_carry_fwd hol_entitlement, ee_hol_taken,sum(decode(SIGN(to_char (msa_date, 'DDD') - to_char (sysdate, 'DDD')), -1, decode(msa_duration, -3, 1, 0.5), 0)) total_hol_taken,
sum(decode(msa_duration, -3, 1, 0.5)) total_hol_booked
FROM eels, msa, ms, ee
WHERE eels.eels_year + 1 = 2010
AND msa_date = ms_date
AND ms_ds_std_day <> '0'
AND ee_empno = msa_empno
AND (ee_lvdate is Null)
AND to_char (msa_date, 'YYYY') = 2010
AND msa_timecode = '300'
AND ms_empno = ee_empno
GROUP BY ee_empno, ee_title || ' ' || ee_inits || ' ' || ee_sname, ee_dept, ee_company, ee_hol_enttlment + eels_carry_fwd, ee_hol_taken
ORDER BY ee_empno, ee_dept
I have tried to Google but the only thing I have found is that using reserved keywords in the wrong place could throw errors. The only keyword I can see in this query is 'sysdate', and if I try to replace that with a subquery (SELECT sysdate FROM DUAL) it them tells me it cannot add the table ''DDD'))'.
Any help would be appreciated.
Thanks
Kat
I'm such a noob