db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: default (0)
Date Wed, 15 Aug 2007 14:49:35 GMT
Mark Thornton <mthornton@optrak.co.uk> writes:

> Derby 10.2.2 appears to reject constant expressions enclosed in
> parentheses (which should still be constant).

I think this is correct according to the SQL standard; in section
"11.5 <default clause>" of ISO/IEC 9075-2:2003, the syntax is shown
as:

<default clause> ::= DEFAULT <default option>

<default option> ::=
  <literal>
| <datetime value function>
| USER
| CURRENT_USER
| CURRENT_ROLE
| SESSION_USER
| SYSTEM_USER
| CURRENT_PATH
| <implicitly typed value specification>

and once you add parentheses around the zero, it is no longer a
literal, although constant.

Dag


>
> CREATE TABLE APP.ArcConstraintGroups (
> ConstraintGroupID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
> Name VARCHAR(128),
> usePenaltyCosts SMALLINT DEFAULT (0),
> Description LONG VARCHAR,
> matrixID INTEGER NOT NULL,
> CONSTRAINT PK__ArcConstraintGro__762C88DA PRIMARY KEY (ConstraintGroupID)
> )
>
> results in
>
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at
> line 5, column 34.

Mime
View raw message