Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选

首页 / 数据库 / MySQL / 实现Oracle数据库的逐渐自增

将表t_uaer的字段ID设置为自增:(用序列sequence的方法来实现)----创建表
Create table t_user(
Id number(6),userid varchar2(20),loginpassword varchar2(20),isdisable number(6)
);----创建序列
create sequence user_seq
increment by 1
start with 1
nomaxvalue
nominvalue
nocache----创建触发器
create or replace trigger tr_user
before insert on t_user
for each row
begin
select user_seq.nextval into :new.id from dual;
end;----测试
insert into t_user(userid,loginpassword, isdisable)
values("ffll","liudddyujj", 0);
insert into t_user(userid,loginpassword, isdisable)
values("dddd","zhang", 0)
select * from t_user;
就可以看出结果。
  • 1
  • 2
  • 下一页
Ubuntu下phpMyAdmin修改超时时长MySQL运用实战相关资讯      oracle 
  • [INS-32052] Oracle基目录和Oracle  (07/22/2014 07:41:41)
  • Oracle 4个大对象(lobs)数据类型  (02/03/2013 12:33:05)
  • Oracle按时间段分组统计  (07/26/2012 10:36:48)
  • [Oracle] dbms_metadata.get_ddl的  (07/12/2013 07:37:30)
  • Liferay Portal 配置使用Oracle和  (07/31/2012 20:07:18)
  • Concurrent Request:Inactive   (07/20/2012 07:44:05)
本文评论 查看全部评论 (0)
表情: 姓名: 字数