SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
C-173
CURRENT Function
CURRENT Function
CURRENT is a function that returns the current local date, time, or both as a value of
type DATETIME.
SQL evaluates CURRENT only once in an SQL statement. If you use CURRENT more
than once in the same statement, each reference returns the same value.
[start-date-time TO ] end-date-time
specifies the range of DATETIME fields on which CURRENT operates. The default
is YEAR TO FRACTION(6).
precision
is an unsigned integer in the range 1 through 6 that specifies the number of
significant digits with which the fraction of a second is expressed. The default is 6.
Example—CURRENT
If you execute an SQL statement on February 20, 2004 at 11:30 pm that contains this
call to CURRENT:
CURRENT YEAR TO DAY
the function returns this value:
2004-02-20
CURRENT [ [start-date-time TO ] end-date-time]
start-date-time is:
{ YEAR }
{ MONTH }
{ DAY }
{ HOUR }
{ MINUTE }
{ SECOND }
{ FRACTION }
end-date-time is:
{ YEAR }
{ MONTH }
{ DAY }
{ HOUR }
{ MINUTE }
{ SECOND }
{ FRACTION [ (precision) ] }