0
Not a bug

On update constraint is not generated in SQL

Saeed Rahimi 4 years ago updated by Rafał Strzaliński (Senior Engineer) 4 years ago 2

I am testing the tool and have created two tables (Customer and Project) with one reference (1-m) from customer to project. I also have 2 constraints - one on delete and one for on update. The generated SQL statement does not have the on update constraint clause. Why? Here is the SQL generated.

-- Created by Vertabelo (http://vertabelo.com)

-- Last modification date: 2016-07-18 18:28:56.15

-- tables
-- Table: Customer
CREATE TABLE Customer (
    Cname varchar2(20)  NOT NULL,
    Rating number(2)  NULL,
    CONSTRAINT Customer_pk PRIMARY KEY (Cname)
) ;

-- Table: Project
CREATE TABLE Project (
    PNo number(5)  NOT NULL,
    Pname varchar2(15)  NULL,
    Customer_Cname varchar2(20)  NOT NULL,
    CONSTRAINT Project_pk PRIMARY KEY (PNo)
) ;

-- foreign keys
-- Reference: Project_Customer (table: Project)
ALTER TABLE Project ADD CONSTRAINT Project_Customer
    FOREIGN KEY (Customer_Cname)
    REFERENCES Customer (Cname)
    ON DELETE CASCADE;

-- End of file.


Answer

Answer

Hello,


Oracle 11g does not support ON UPDATE clause. Please see documentation on REFERENCES: https://docs.oracle.com/cd/B28359_01/server.111/b28286/clauses002.htm#CJAIHHGC

You can emulate this behaviour, tutorial: http://www.dba-oracle.com/oracle_tips_cascade_update.htm


We don't disable 'on update' select for Oracle in UI so it might be confusing...


Note: If you choose another DB engine (for example Postgres), Vertabelo will generate ON UPDATE clause.



Answer

Hello,


Oracle 11g does not support ON UPDATE clause. Please see documentation on REFERENCES: https://docs.oracle.com/cd/B28359_01/server.111/b28286/clauses002.htm#CJAIHHGC

You can emulate this behaviour, tutorial: http://www.dba-oracle.com/oracle_tips_cascade_update.htm


We don't disable 'on update' select for Oracle in UI so it might be confusing...


Note: If you choose another DB engine (for example Postgres), Vertabelo will generate ON UPDATE clause.