Adding a second to date
Hi All,
I found this interesting in share with you all. There was a requirement where because of timestamp of a date column value, BODS job was getting fail and we had to go update the date value to ADD one second to it. Later the job got completed successfully. Here is the below query for your reference.
select TO_CHAR(sysdate, ‘DD-MON-YYYY HH:MI:SS AM’) NOW, TO_CHAR(sysdate+1/(24*60*60),’DD-MON-YYYY HH:MI:SS AM’) NOW_PLUS_1_SEC from dual;
Hope this is helpful.
Thanks,
Abdulrasheed.
1/(24*60*60) will give us the fraction of the day. adding that to sysdate will increase the day by 1/86400th part which is 1 sec. This is interesting and thanks for sharing.
Hi,
I've used that method to add seconds before but have been caught out with rounding errors. This was within the SAP DataServices engine rather than in database SQL, i.e. in a script.
Instead I use,
which will add 1 second to the variable.