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: User's question
Date Tue, 23 Sep 2008 17:30:22 GMT
Евгений Никулов <nikulov@ulk.ru> writes:

>  
>
>   Hello.
>
>   Would you be so kind as answer on my question?
>
>   How can I do cascade update in the Derby Java DB.
>
>   The following code begets a mistake:
>
>  
>
>   CREATE TABLE "COUNTRIES" (
>
>       "ID"              INTEGER not null generated by default as identity
> (START WITH 1, INCREMENT BY 1),
>
>       "NAME"            VARCHAR(50) not null,
>
>  
>
>       CONSTRAINT coun_pk 
>
>       PRIMARY KEY(ID)
>
>  
>
>   );
>
>  
>
>   CREATE TABLE "LANGUAGES" (
>
>       "ID_COUNTRY"      INTEGER not null,
>
>       "LANGUAGE"        VARCHAR(50),
>
>  
>
>       CONSTRAINT lang_fk
>
>       FOREIGN KEY (ID_COUNTRY)
>
>       REFERENCES COUNTRIES (ID)
>
>       ON DELETE CASCADE
>
>       ON UPDATE CASCADE (string of error)
>
>  
>
> );
>
>  
>
> Error code -1, SQL state 42X01: Syntax error: Encountered "CASCADE" at line
> : (string of error)

Please have a look here:

http://db.apache.org/derby/docs/10.4/ref/rrefsqlj16357.html

Derby allows these actions on the UPDATE clause: NO ACTION or
RESTRICT. So, in your example you get a syntax error on the CASCADE.

You would have to work around this restriction.


Thanks,
Dag

Mime
View raw message