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: Alter table add constraints
Date Thu, 16 Aug 2007 12:30:54 GMT
Mark Thornton <mthornton@optrak.co.uk> writes:

> The syntax in the documentation
> (http://db.apache.org/derby/docs/dev/ref/rrefsqlj81859.html) implies
> that you can add more than one constraint in a single alter table

Does it? If a syntactic element can be repeated, there will be an
asterisk trailing it. Braces is merely used for grouping. What part of
the docs are you referring to?

> statement, as in this example
>
> ALTER TABLE APP.ACTIVEVEHICLES
> ADD CONSTRAINT FK__ACTIVEVEH__VEHIC__7A3223E8 FOREIGN KEY (VEHICLEID)
> REFERENCES APP.BASEVEHICLES (VEHICLEID) ON DELETE CASCADE
> ADD CONSTRAINT FK_ACTIVEVEHICLES_SOLUTIONS FOREIGN KEY (SOLUTIONID)
> REFERENCES APP.SOLUTIONS (SOLUTIONID) ON DELETE CASCADE
>
> This results in this exception:
>
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "ADD" at
> line 4, column 1.
>
> SQL-92 only allowed one alteration per alter table statement, I don't
> have a copy of later standards.

This is true for SQL 2003 as well.

Thanks,
Dag

>
> Regards,
> Mark Thornton

Mime
View raw message