这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下:

  create table simon_example

  (

  id number(4) not null primary key,

  name varchar2(25)

  )

  -- 建立序列:

  -- Create sequence

  create sequence SIMON_SEQUENCE

  minvalue 1

  maxvalue 999999999999999999999999999

  start with 1

  increment by 1

  cache 20;

  -- 建立触发器

  create trigger "simon_trigger" before

  insert on simon_example for each row when(new.id is null)

  begin

  select simon_sequence.nextval into:new.id from dual;

  end;

oracle主键自增长的更多相关文章

  1. oracle 主键自动增长

    oracle 主键自动增长 2009-12-11 16:07:00|  分类: 数据库资料|字号 订阅     这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下: create tabl ...

  2. Mysql,SqlServer,Oracle主键自动增长的设置

    1.把主键定义为自动增长标识符类型 MySql 在mysql中,如果把表的主键设为auto_increment类型,数据库就会自动为主键赋值.例如: )); insert into customers ...

  3. MySQL 和 Oracle 主键自增长

    1.MySQL 1)建表 auto_increment:每插入一条数据,客户表(customers)的主键id就自动增1,如下所示 create table customers -- 创建客户表 ( ...

  4. Mysql,SqlServer,Oracle主键自动增长的设置

    在mysql中,如果把表的主键设为auto_increment类型,数据库就会自动为主键赋值.例如: CREATE TABLE google(id INT AUTO_INCREMENT PRIMARY ...

  5. 设置oracle主键自增长

    创建test表后,创建序列: CREATE sequence seq_test INCREMENT BY 1 START WITH 1 minvalue 1   成功后,插入一条语句进行测试:   I ...

  6. mybatis配置oracle的主键自增长

    引用自:https://hacpai.com/article/1405392025960 mysql.sqlserver等数据库本身带有主键自增长像auto_increment的功能可以直接使用 us ...

  7. oracle 主键应用序列和触发器实现自动增长

    oracle 主键自动增长 这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下: create table simon_example ( id number(4) not null pr ...

  8. Oracle实现主键自增长

    -- 主键设置:xx_id number(24) primary key 1 create sequence XX_seq --序列名称 increment by 1 -- 每次加几个 start - ...

  9. Oracle 设置主键自增长__Oracle

    转自:https://yq.aliyun.com/ziliao/258074 如果想在Oracle数据库里实现数据表主键自增,我们似乎没有办法像MySql般直接定义列的属性来实现.不过对于这个数据库的 ...

随机推荐

  1. SQL Server扩展事件system_health会话总结

    system_health会话概念 我们知道扩展事件(Extended Events)是从SQL Server 2008开始引入的.system_health会话是SQL Server默认包含的扩展事 ...

  2. 使用Python+selenium过程中所需安装的库和软件

    一.下载地址: 1.setuptools:https://pypi.python.org/pypi/setuptools#downloads 中file对应的后缀为zip的软件 pip:https:/ ...

  3. 学习Linux的好网站

    http://www.linuxcommand.org/ 很不错的学习shell和script的教程.包含:Learning the shell 和 writing shell scripts 两个内 ...

  4. Berkeley DB (VC6.0 编译环境配置)

    操作系统:winxp VC环境:VC6.0 必需文件:Berkeley DB安装文件(db-.msi) 下载地址:http://www.oracle.com/technology/software/p ...

  5. git 作成

    Git global setup git config --global user.name "高 文龍" git config --global user.email " ...

  6. KMP算法入门讲解

    字符串匹配问题.假设文本是一个长度为$n$的字符串$T$,模板是一个长度为$m$的字符串$P$,且$m\leq n$.需要求出模板在文本中的所有匹配点$i$,即满足$T[i]=P[0],T[I+1]= ...

  7. 《大规模 web服务开发》笔记

    大规模服务:     可扩展,负载均衡,保证冗余,低运维成本,开发人数和开发方法的变化 数据处理:     磁盘—>内存—>缓存—>CPU 障碍:     持续增长的服务,”无法在内 ...

  8. SC || Chapter 1

    第一章的重中之重就是这张图吧 (具体参见笔记) ┉┉∞ ∞┉┉┉┉∞ ∞┉┉┉∞ ∞┉┉┉┉∞ ∞┉┉┉┉∞ ∞┉┉┉∞ ∞┉┉┉┉∞ ∞┉┉┉┉∞ ∞┉┉┉∞ ∞┉┉ 区分哪些属性是外部的(面向用户 ...

  9. JavaScript学习整理(转载)

    JavaScript的学习整理(一) 目录: 1.换皮肤功能2.显示/隐藏(点击切换)3.显示/隐藏(onmouseover/onmouseout)4.选项卡5.全选/不选/反选(checkbox)6 ...

  10. cocos2dx lua 吞噬层的触摸事件

    首先要创建一个layer,设置该层为可触摸 layer:setTouchEnabled(true) 注册触摸事件 local listener = cc.EventListenerTouchOneBy ...