SQL-J Language Reference,
Page 73 of 118


[top]
[prev]
[next]
Documentation Top
Global Index
Reference Manual
TOC Index
Grammar index
Developer's Guide
TOC Index
Tuning Cloudscape
TOC Index

EXTRACT

EXTRACT extracts the specified field from a date/time expression as an integer or double-precision value.

Syntax

EXTRACT (Field FROM DateTimeExpression)

The fields available for extraction depend on the date/time type that EXTRACT is applied to, as listed in Table 1-3, “Extractable Fields in Date/Time Data Types”

Table 1-3 Extractable Fields in Date/Time Data Types
Field DATE TIME TIMESTAMP

YEAR

X

X

MONTH

X

X

DAY

X

X

HOUR

X

X

MINUTE

X

X

SECOND

X

X

.

The result type of EXTRACT is INTEGER except when extracting SECOND from a TIMESTAMP. In the current release, the result type of extracting SECOND from a TIMESTAMP is DOUBLE PRECISION. The result type of extracting SECOND from a TIME is an INT.

Example

EXTRACT(MONTH FROM DATE'1995-01-01') -- returns 1
[top]
[prev]
[next]


Cloudscape Version 3.0
For technical support, go to: www.cloudscape.com and click Support.
Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved.