Conversion of query from oracle to mysql -


how convert below query oracle mysql.

alter table test add constraint test_fk foreign key (id) references another_table(id) on delete cascade enable novalidate;

when convert got following error in mysql

error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'enable novalidate' can body please me on this.

thanks skp

this standard syntax of adding foreign key using alter query official

alter table tbl_name add [constraint [symbol]]      foreign key [index_name] (index_col_name, ...)     references tbl_name (index_col_name,...)     [on delete reference_option]     [on update reference_option] 

in query delete enable novalidate. try this

alter table test    add constraint test_fk        foreign key (id) references another_table(id)        on delete cascade; 

example http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html

alter table products   add foreign key fk_vendor(vdr_id) references vendors(vdr_id)       on delete no action       on update cascade; 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -