SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual540440-003
9-36
CURRENT_TIME Function
CURRENT_TIME Function
The CURRENT_TIME function returns the current local time as a value of type TIME.
precision
is an integer value in the range 0 to 6 that specifies the precision of (the number of
decimal places in) the fractional seconds in the returned value. The default is 0.
For example, the function CURRENT_TIME (2) returns the current time as a value
of data type TIME, where the precision of the fractional seconds is 2—for example,
14:01:59.30. The value returned is not a string value.
Examples of CURRENT_TIME
Suppose that the LOGFILE table has been created in NonStop SQL/MP as:
CREATE TABLE $sys.stats.logfile
( user_key NUMERIC (3) UNSIGNED NO DEFAULT NOT NULL
,run_date DATE
,run_time TIME
,user_name VARCHAR (20)
,user_info VARCHAR (80)
,PRIMARY KEY (user_key))
CATALOG $sys.stats
ORGANIZATION KEY SEQUENCED;
After the table is created, you can insert the mapping into the OBJECTS table in this
way by using MXCI:
CREATE SQLMP ALIAS sys.stats.logfile $sys.stats.logfile;
Use CURRENT_DATE and CURRENT_TIME as a value in an inserted row:
INSERT INTO stats.logfile
(user_key, run_date, run_time, user_name)
VALUES (001, CURRENT_DATE, CURRENT_TIME, 'JuBrock');
CURRENT_TIME [(precision)]