Unanswered: How to subtract days from timestamp variable
My requirement is to subtract days from a timestamp variable.
This is my Store proc. code:
create or replace procedure test_date_proc ( IN LASTRUN TIMESTAMP, IN NO_DAYS_BEFORE INTEGER, OUT_EFF_RUN TIMESTAMP )
DECLARE LASTRUN TIMESTAMP;
DECLARE NO_DAYS_BEFORE INTEGER;
DECLARE OUT_EFF_RUN TIMESTAMP;
set OUT_EFF_RUN= LASTRUN - NO_DAYS_BEFORE;
One of the input variable is a timestamp, and the other is integer.
I would like the output variable in TIMESTAMP.
eg: 2012-09-06-22.214.171.124792 - 3 = 2012-09-03-126.96.36.199792
How to write the SET statement for this? Thanks in advance.