oracle 触发器实现主键自增
2014-05-15 09:28
218 查看
drop table book; --创建表 create table book( bookId varchar2(4) primary key, name varchar2(20) ); --创建序列 create sequence book_seq start with 1 increment by 1; --创建触发器 create or replace trigger book_trigger before insert on book for each row begin select book_seq.nextval into :new.bookId from dual; end ; --添加数据 insert into book(name) values ('cc'); insert into book(name) values ('dd'); commit; 查询数据:select * from book; 查询 select * from user_objects ubs where ubs.OBJECT_TYPE='SEQUENCE';
相关文章推荐
- 在Oracle下实现主键自增(触发器)
- oracle利用触发器实现主键的自动增加
- oracle 利用序列和触发器实现主键自增demo
- Oracle序列和触发器实现表的主键自增
- Oracle学习记录之使用自定义函数和触发器实现主键动态生成
- oracle使用序列和触发器实现主键的自动增长
- oracle主键自增长_序列及触发器实现
- 在oracle下触发器实现主键自增
- oracle 主键应用序列和触发器实现自动增长
- Oracle主键自增(触发器实现)
- oracle下触发器实现主键自增
- Oracle用触发器实现插入数据主键自增
- 在oracle下触发器实现主键自增
- Oracle创建触发器实现主键自增
- Oracle 使用触发器实现主键自动增长
- Oracle 实现主键自动增长之序列,触发器
- Oracle创建主键自增表(sql语句实现)及触发器应用
- Oracle序列和触发器实现表的主键自增
- Oracle学习记录之使用自定义函数和触发器实现主键动态生成
- Oracle - 使用序列+触发器实现主键自增长