oracle创建主键自增字段
2013-04-15 21:33
393 查看
创建表 create table LoginUser ( Pid number(6) primary key, username varchar(20) not null, userpwd varchar(20) not null, usertype varchar(12) not null ); 创建序列 create sequence LoginUser_seq increment by 1 start with 1 nomaxvalue nominvalue nocache 创建触发器其中一定要注意new.pid这个地方 create or replace trigger tr_user before insert on loginuser for each row begin select LoginUser_seq.nextval into :new.pid from dual; end; 执行sql插入语句 insert into LoginUser(username,Userpwd,Usertype) values('jack','123','管理员'); insert into LoginUser(username,Userpwd,Usertype) values('jney','123','普通用户'); 查看执行结果 select * from loginuser
相关文章推荐
- Oracle使用序列创建自增字段(主键自动增长)
- Oracle创建表、索引、主键、字段描述
- [转 逆水行船]Oracle中创建表,创建序列,创建自增字段,添加注释, 添加记录,添加触发器,提交
- 创建序列和触发器实现Oracle字段自增功能
- oracle 创建表空间、表、主键、外键、序列
- Oracle创建自增字段方法-ORACLE SEQUENCE的简单介绍
- oracle的序列使用,创建、表中调用、主键自动生成
- oracle创建自增主键过程与错误分析
- [笔记]--Oracle创建主键自增表
- Oracle、Mysql、SqlServer创建表和给表和字段加注释
- oracle 创建自增列 及oracle表的字段的子节点的查询
- 获取oracle 表字段,表名,以及主键之类等等的信息。
- Oracle 创建自增字段的方法—使用序列方法(1)
- oracle 创建主键反向索引
- 如何在ORACLE中创建一个自增字段?
- ORACLE 批量插入 主键为自增序列 有几个字段数据从其他表导入的 有几个是固定的
- oracle 创建表空间、表、主键、外键、序列
- 获取ORACLE 表字段,表名,以及主键之类等等的信息
- Oracle创建自增字段方法
- Oracle创建主键时处理重复数据的程序