Reputation: 2239
I have this code:
DEFINE value1 = '20-JUL-20';
SELECT to_DATE(&&value1, 'DD-MON-YY') from dual;
But returns this error:
ORA-00904: "JUL": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 17 Column: 19
It seems it is having problem converting the string to date. I am wondering if you guys can explain why and if there is a fix to it. Thanks.
Upvotes: 0
Views: 148
Reputation: 222542
You need single quotes around the substitution variable:
DEFINE value1 = '20-JUL-20';
SELECT to_DATE('&&value1', 'DD-MON-YY') from dual;
Upvotes: 3