Hi All,
Unable to use date format in EXECUTE IMMEDIATE.
DECLARE
v_date DATE;
BEGIN
v_date := TO_DATE('20-01-1981','DD-MM-YYYY');
EXECUTE IMMEDIATE 'create table test_emp as select * from emp where TRUNC(HIREDATE)>= ' || v_date;
END;
Getting below error while executing the above script.
Error report -
ORA-00932: inconsistent datatypes: expected DATE got NUMBER
ORA-06512: at line 5
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
How to solve it.
I am using Oracle Database 19c.
Thanks in advance.
Best Regards,
Abu