zoukankan      html  css  js  c++  java
  • 触发器

    http://zhidao.baidu.com/link?url=gEP3U9q13tDagS9klKCtpDgjkGWkkOMFDveW-1aNiuV3vLfSIecmMEueHVwdnv-dISb7Zx6maCjEcwGHS3jgdq

    http://www.jb51.net/article/33548.htm

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    要先有个序列才行 
    create or replace trigger Trigger_pa_user_key

    before insert on pa_user
    for each row
    begin
     SELECT S_pa_user.nextval INTO :new.id FROM dual;
    end;
    你可以在执行插入时候  先truncate table 
     

    -- Create table
    create table USERDEMO
    (
    id NUMBER not null,
    name VARCHAR2(20)
    )
    tablespace DEMO
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    );
    -- Create/Recreate primary, unique and foreign key constraints
    alter table USERDEMO
    add constraint USERDEMO primary key (ID)
    using index
    tablespace DEMO
    pctfree 10
    initrans 2
    maxtrans 255
    storage
    (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
    );

    ++++++++++++++++++++++++++++++++++++++++++++++++++

    -- Create sequence
    create sequence USERDEMOSEP
    minvalue 1
    maxvalue 9999999999999999999999
    start with 21
    increment by 1
    cache 20
    order;

    ++++++++++++++++++++++++++++++++++++++++++++++++++

    create or replace trigger Trigger_user_key

    before insert on userdemo
    for each row
    begin
    SELECT userdemosep.nextval INTO :new.id FROM dual;
    end;

    ++++++++++++++++++++++++++++++++++++++++++++++++++++


    insert into userdemo (name) values('jj');

    ++++++++++++++++++++++++++++++++++++++++++++++++++++

  • 相关阅读:
    爬虫开头
    JAVA练习笔记---copyfile
    String
    十进制转化为八进制--栈实现
    一、给计算机专业的同学,计算机鸡汤
    数值的整数次方
    剪绳子-动态规划-贪婪
    二进制中为1 的数字个数
    机器人运动范围——回溯法应用
    矩阵的路径
  • 原文地址:https://www.cnblogs.com/zshboke-2015/p/5018741.html
Copyright © 2011-2022 走看看