0705_oracle 序列

来源:这里教程网 时间:2026-03-03 14:29:58 作者:

---序列sequnece user_sequneces increment  by   2   -----步长 start with      2    ----起始值         maxvalue       10     --最大值  2 4 6 8 10 nomaxvalue      minvalue        2    最小值 nominvalue            cycle           循环      nocycle  cache       2               缓存  nocache order                排序 noorder              1         3    5  7            15  create sequnece  seq1  start with  1   increment  by  2 maxvalue  15 nocycle; 引用序列 当前值            序列名.currval 下一个值          序列名.nextval create sequence  seq3  start with  1   increment  by  2 maxvalue  7 cycle; create sequence  seq3  start with  1   increment  by  2 maxvalue  6 cycle nocache; create sequence  seq3  start with  3   increment  by  2  maxvalue  6  minvalue  2  cycle nocache; cache   5 1 2 3 4 5  1  2 3 4 5 6 7 8 9 10  11 ---修改序列属性 ALTER SEQUENCE  xx   序列属性   新值 ---临时表 购物车----TABLE (1)事务结束 commit rollback (2)会话结束  exit create global temporary table gwc(price number(4),name varchar2(20)) --事务 create global temporary table gwc(price number(4),name varchar2(20)) on commit  preserve rows; ------------------------------------- 约束                     constraint 维护数据的完整性 删除约束 SQL> ALTER TABLE nn1  DROP CONSTRAINT  SYS_C0011064; 五大约束 非空约束 唯一约束 主键约束 外建约束 检查约束--自定义约束 非空约束---不让插入null值 1--关键字---NOT NULL 2--类型--C 3---一个表中允许有多个非空约束 4---非空约束会继承 5---不支持组合列约束 唯一约束-----不允许插入重复的值,但是null除外 1----关键字    UNIQUE 2---- 类型     U 3---一个表中允许有多个唯一约束 4---唯一约束不会继承 5---支持组合列约束 主键约束-----非空 + 唯一 1---关键字 primary key 2----类型    P 3---一个表中猪油一个主键约束 4---约束不会继承 5---支持组合列约束 外建约束

相关推荐