ORACLE 主键外键问题 建立序列

来源:互联网 发布:数据库开启事务 编辑:程序博客网 时间:2024/05/22 04:58

添加主键:

alter table CWH_REPORT add primary key (ID);

添加外键:

alter table 子表名 add constraint 子表名 foreign key(子表字段) references c父表名(父表字段)  on delete CASCADE;级联删除。

同时注意一点Oracle没有级联更新,如果想更新需要用触发器。



create sequence seq_cwh_sub_monitor_log
minvalue 1
maxvalue 99999999999
start with 1
increment by 1
nocache
order;

0 0
原创粉丝点击