DECLARE
v_sql_stmt VARCHAR2(2000);
v_INSERT_DATETIME TIMESTAMP(6);
BEGIN
SELECT
MAX(INSERT_DATETIME)
INTO V_INSERT_DATETIME
FROM
LOG_TABLE;
v_sql_stmt := 'INSERT INTO LOG_TABLE (ID,USER,INSERT_DATETIME) SELECT ID,USER,CREATE_DATETIME FROM OLD_OLG_TABLE
WHERE (CREATE_DATETIME>:V_INSERT_DATETIME OR REVIEW_DATETIME >:V_INSERT_DATETIME)';
EXECUTE IMMEDIATE v_sql_stmt USING :V_INSERT_DATETIME, :V_INSERT_DATETIME;
END;
/
HERE I am getting ORA-01830: date format picture ends before converting entire input string.
I tried to pass like
TO_TIMESTMAP(:V_INSERT_DATETIME, 'DD-MON-RR HH.MI.SSXFF AM') and
TO_TIMESTMAP(:V_INSERT_DATETIME, 'DD-MON-RR HH12.MI.SS.FF6 AM')
But I have got ORA-00904: "TO_TIMESTMAP": invalid identifier.
The INSERT_DATETIME is TIMESTAMP(6) and has values like '28-AUG-25 08.03.28.577664 PM' in table.
Any suggestion is appreciated. Thanks in advance
TO_TIMESTMAPorTO_TIMESTAMP? dbfiddle.uk/ikPF_AfnCREATE TABLEandINSERTstatements for your tables and sample data so that we can replicate the issue.TO_TIMESTAMPis, I am assuming, that you are passingTO_TIMESTAMP(...)as the value to the bind variable and does not make sense as bind variables do not work like substitution variables and, if you fix the underlying issue then that issue becomes irrelevant.