oracle创建表

来源:互联网 发布:美剧推荐知乎 编辑:程序博客网 时间:2024/06/09 17:13

创建表,表名t_user,元素userid、username、userpwd

create table t_user(userid number(10) not null primary key, username varchar2(40) not null, userpwd number(10) not null);

创建序列化,USER_PRIMARY

create sequence USER_PRIMARYminvalue 1maxvalue 999999999999999999999999999start with 21increment by 1cache 20order;

创建触发器,user_autoinc_tg

create or replace trigger user_autoinc_tgbefore insert on t_user for each rowbeginselect user_primary.nextval into :new.userid from dual;end user_autoinc_tg;



 



 

0 0