27.10.2013 Views

Firebird 2.1 Release Notes

Firebird 2.1 Release Notes

Firebird 2.1 Release Notes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Data Definition Language (DDL)<br />

SQL2003 Compliant Alternative for Computed Fields<br />

D. Yemanov<br />

Feature request CORE-1386<br />

(v.<strong>2.1</strong>) SQL-compliant alternative syntax GENERATED ALWAYS AS was implemented for defining a computed<br />

field in CREATE/ALTER TABLE.<br />

Syntax Pattern<br />

[] GENERATED ALWAYS AS ( )<br />

It is fully equivalent semantically with the legacy form:<br />

[] COMPUTED [BY] ( )<br />

Example<br />

CREATE TABLE T (PK INT, EXPR GENERATED ALWAYS AS (PK + 1))<br />

CREATE SEQUENCE<br />

D. Yemanov<br />

SEQUENCE has been introduced as a synonym for GENERATOR, in accordance with SQL-99. SEQUENCE<br />

is a syntax term described in the SQL specification, whereas GENERATOR is a legacy InterBase syntax term.<br />

Use of the standard SEQUENCE syntax in your applications is recommended.<br />

A sequence generator is a mechanism for generating successive exact numeric values, one at a time. A sequence<br />

generator is a named schema object. In dialect 3 it is a BIGINT, in dialect 1 it is an INTEGER.<br />

Syntax patterns<br />

CREATE { SEQUENCE | GENERATOR } <br />

DROP { SEQUENCE | GENERATOR } <br />

SET GENERATOR TO <br />

ALTER SEQUENCE RESTART WITH <br />

GEN_ID (, )<br />

NEXT VALUE FOR <br />

Examples<br />

1.<br />

CREATE SEQUENCE S_EMPLOYEE;<br />

39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!