Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Language Elements : Data types : Literals : Date-time literals : Time literals
 
Time literals
Time literals specify an hour, minute, second, and millisecond, using the following format, enclosed in single quotation marks (' ' ).

Syntax

This is the syntax for time literals:
{ t hh:mi:ss[:mls] }

Parameters

{ t 'hh:mi:ss' }
A time literal enclosed in an escape clause is compatible with ODBC. Precede the literal string with an open brace ( { ) and a lowercase t. End the literal with a close brace ( } ).
Note: If you use the ODBC escape clause, you must specify the time using the format hh:mi:ss.
hh
Specifies the hour value as a two‑digit number in the range 00 to 23.
mi
Specifies the minute value as a two‑digit number in the range 00 to 59.
ss
Specifies the seconds value as a two‑digit number in the range 00 to 59.
mls
Specifies the milliseconds value as a three‑digit number in the range 000 to 999.

Examples

The following example illustrates how to use the time literal format with an INSERT statement:
INSERT INTO ttest VALUES ( { t '23:22:12' } ) ;
The INSERT statements in the following example show some of the formats 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:1:1');
INSERT INTO T2 (C2) VALUES({t'8:30:1:1'});
The SELECT statement in the following example illustrates which INSERT statements successfully inserted a row:
SELECT C2 FROM T2;c2
c2
--
08:30:01
08:30:00
08:30:01
08:30:01