It looks like td
is a string representation of a date, so dtime_t
seems to be a structure - possibly a VARCHAR
. If so, you're doing an implicit date conversion at the moment, which isn't a good idea anyway as it relies on the NLS settings of the client application; which are maybe controlled in a Pro*C app more than in other scenarios, but still a potential failure point. But in this case you're trying to subtract the interval from the string before that implicit conversion has happened; hence the ORA-30081 error.
Changing that to an explicit conversion would allow the interval arithmetic:
update anp
set lssn = :ssn,
ltd = to_date(:td, 'YYYY-MM-DD HH24:MI:SS') - interval '1' minute;
A simple demonstration:
select '2014-01-02 14:44:03' - interval '1' minute from dual;
SQL Error: ORA-30081: invalid data type for datetime/interval arithmetic
30081. 00000 - "invalid data type for datetime/interval arithmetic"
*Cause: The data types of the operands are not valid for datetime/interval
arithmetic.
Versus:
select to_date('2014-01-02 14:44:03', 'YYYY-MM-DD HH24:MI:SS')
- interval '1' minute from dual;
TO_DATE('2014-01-0214:44:03','YYYY-MM-DDHH24:MI:SS')-INTERVAL'1'MINUTE
----------------------------------------------------------------------
2014-01-02 14:43:03