Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

Time Literals

Time literals specify an hour, minute, second, and millisecond, using the following format, enclosed in single quotation marks ( ' ):

Syntax

time-literal ::

{t 'hh:mi:ss'}

| hh:mi:ss

Arguments

{t 'hh:mi:ss'}

A time literal enclosed in an escape clause compatible with ODBC. Precede the literal string with an open brace ( { ) and a lowercase t. End the literal with a close brace. For example:

INSERT INTO TTEST VALUES ({t '23:22:12'})

If you use the ODBC escape clause, you must specify the time using the format hh:mi:ss.

hh

The hour value as a 1- or 2-digit number (in the range 00 to 23).

mi

The minute value as a 1- or 2-digit number (in the range 00 to 59).

ss

The seconds value as a 1- or 2-digit number (in the range 00 to 59).

Examples

The following FairCom DB SQL examples show some of the formats FairCom DB SQL will and will not accept for time literals:

INSERT INTO T2 (C2) VALUES('3');

error(-20234): Invalid time string

INSERT INTO T2 (C2) VALUES('8:30');

error(-20234): Invalid time string

INSERT INTO T2 (C2) VALUES('8:30:1');

INSERT INTO T2 (C2) VALUES('8:30:');

error(-20234): Invalid time string

INSERT INTO T2 (C2) VALUES('8:30:00');

INSERT INTO T2 (C2) VALUES('8:30:01');

INSERT INTO T2 (C2) VALUES({t'8:30:01'});

SELECT C2 FROM T2;

c2

08:30:01

08:30:00

08:30:01

08:30:01

TOCIndex