Reputation: 23
I'm getting ORA:00936 error for the following query.Please let me know the issue in the query
SELECT convert(DATE,r.created_dt) as created_dt,
r.created_dt as time,
r.rep_id,
rt.rep_type_id,
rt.rep_type_desc
FROM t_tbm_ia_rep_2015 r,
t_tbm_ia_rep_type_2015 rt
WHERE r.rep_type_id=rt.rep_type_id
GROUP BY r.created_dt,
r.rep_id,
rt.rep_type_id,
rt.rep_type_desc
ORDER BY rt.rep_type_id
Upvotes: 2
Views: 2828
Reputation: 49062
SELECT convert(DATE,r.created_dt) as created_dt
The issue is with the incorrect use of CONVERT function. Please see the documentation.
SQL> SELECT convert(DATE,hiredate) as created_dt from emp;
SELECT convert(DATE,hiredate) as created_dt from emp
*
ERROR at line 1:
ORA-00936: missing expression
SQL>
I guess you are trying convert the datatype, you could use TO_DATE to convert string into date. Or, TO_CHAR to do vice-versa.
Upvotes: 2