manojkumar16 <[email protected]> writes:
> I am writing a default scheduler for my project and it needs to be triggered
> 7 days later the deployment of project.
> Can somebody help me writing an INSERT statement which takes (CURRENT_DATE +
> 7 days) as a value for DATE field.
>
> INSERT INTO PURGE_ACC (START_DATE, REPEAT_INTERVAL) VALUES ( *(CURRENT_DATE
> + 7 DAYS)*, 604800000);
>
> REPEAT_INTERVAL is of long type and value associated with it is 7 days.
> I am having issue in settting [START_DATE+7 days] value.
Hi Manoj,
There is a JDBC escape function called TIMESTAMPADD that you could use
for this. It produces a timestamp rather than a date, but you can cast
the resulting timestamp to a date and insert it into the table.
I think something like this should do the trick:
insert into purge_acc(start_date, repeat_interval)
values (cast({ fn timestampadd(sql_tsi_day, 7, current_date) } as date),
604800000)
The TIMESTAMPADD function is documented here:
http://db.apache.org/derby/docs/10.10/ref/rrefjdbc88908.html
Hope this helps,
--
Knut Anders