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');

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

  • 相关阅读:
    优化网站设计系列文章总结和导读
    jQuery插件实现select下拉框左右选择_交换内容(multiselect2side)
    php代码生成二维码
    微信公众平台开发(83) 生成带参数二维码
    MySQL主从问题
    mysql配置文件my.cnf
    网站UV,与IP、PV
    git基础使用小记
    系统运维
    [译]Profile and debug your ASP.NET MVC app with Glimpse
  • 原文地址:https://www.cnblogs.com/zshboke-2015/p/5018741.html
Copyright © 2011-2022 走看看