本文主要是介绍Oracle ID 自增代码, Oracle ID 自增是计算机的实际应用中经常使用的计算机语言,如果你对其相关的代码感兴趣的话,你就可以点击以下的文章对其进行了解,望你会有所收获。

成都创新互联公司科技有限公司专业互联网基础服务商,为您提供电信内江机房,高防主机,成都IDC机房托管,成都主机托管等互联网服务。
1.创建表
Sql代码
- -- Create table
 - create table USERS
 - (
 - ID NUMBER not null,
 - USERNAME VARCHAR2(25),
 - PASSWORD VARCHAR2(25),
 - EMAIL VARCHAR2(50)
 - )
 - tablespace USERS
 - pctfree 10
 - initrans 1
 - maxtrans 255
 - storage
 - (
 - initial 64K
 - minextents 1
 - maxextents unlimited
 - );
 - -- Create/Recreate primary, unique and foreign key
 
constraints- alter table USERS
 - add constraint ID primary key (ID)
 - using index
 - tablespace USERS
 - pctfree 10
 - initrans 2
 - maxtrans 255
 - storage
 - (
 - initial 64K
 - minextents 1
 - maxextents unlimited
 - );
 - -- Create table
 - create table USERS
 - (
 - ID NUMBER not null,
 - USERNAME VARCHAR2(25),
 - PASSWORD VARCHAR2(25),
 - EMAIL VARCHAR2(50)
 - )
 - tablespace USERS
 - pctfree 10
 - initrans 1
 - maxtrans 255
 - storage
 - (
 - initial 64K
 - minextents 1
 - maxextents unlimited
 - );
 - -- Create/Recreate primary, unique and foreign key constraints
 - alter table USERS
 - add constraint ID primary key (ID)
 - using index
 - tablespace USERS
 - pctfree 10
 - initrans 2
 - maxtrans 255
 - storage
 - (
 - initial 64K
 - minextents 1
 - maxextents unlimited
 - );
 
2.创建序列
Sql代码
3.创建触发器
Sql代码
- create or replace trigger TRI_USERS_ID
 - before insert on users
 - for each row
 - declare
 - -- local variables here
 - begin
 - SELECT SEQ_USERS_ID.NEXTVAL
 - INTO :NEW.ID
 - FROM DUAL;
 - end TRI_USERS_ID;
 - create or replace trigger TRI_USERS_ID
 - before insert on users
 - for each row
 - declare
 - -- local variables here
 - begin
 - SELECT SEQ_USERS_ID.NEXTVAL
 - INTO :NEW.ID
 - FROM DUAL;
 - end TRI_USERS_ID;
 - Oracle 11g Multimedia DICOM
 
以上就是对Oracle ID 自增的实际应用的代码 的介绍,望你会有所收获。
【编辑推荐】
                当前标题:Oracle ID 自增代码的详细介绍
                
                文章出自:http://www.csdahua.cn/qtweb/news34/251384.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网