Thursday, October 11, 2018

Alternative for Interval Syntax in NetSuite ODBC

Interval syntax is not supported with NetSuite ODBC
 
INTERVAL DAY that is applied directly to TIMESTAMP or DATE types can be replaced with +/- integer.
Example:
replace current_date - interval '7' Day with current_date - 7
Intervals for values smaller than one day can be done similarly by converting them to fractions of a day. However current_date does not support HH:MM:SS and SYSDATE with the TIMESTAMP type is preferable.
Example:
current_date - interval '13' Hour can be replaced with sysdate - 13/24 or sysdate - 1/1.84615

For values larger than days, the function Add_Months( ) can be used (and the numeric parameter multiplied by 12 for years).
Example:
current_date + interval '2' Year can be replaced with Add_Months(current_date, 12*2)

No comments:

Post a Comment