oracle 插入ID自增遇到ORA 03113

2021-08-31 20:13:16 字數 577 閱讀 2488

oracle 插入資料時,id自增,採用觸發器方式,不知何原因,遇到ora-03113,提示資料庫連線斷開,無法提交。

觸發器**

create or replace trigger autoincreaset before

insert on ip for each row //ip為表名

when(new.id is null)

begin

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

end

插入資料

insert into ip(begin_ip,end_ip) 

(select begin_ip,end_ip from report_ip)

刪除觸發器,直接寫sql語句方式,執行正常

insert into ip(id,begin_ip,end_ip)

(select seq_global.nextval,begin_ip,end_ip from report_ip);

參考

Oracle自增ID實現

首先,建立一張表 create table example id number 4 not null primary key,name varchar 25 然後,自定義乙個序列 sequence create sequence example sequence increment by 1 每次加...

oracle 實現id自增

首先,建立一張表 create table example id number 4 not null primary key,name varchar 25 然後,自定義乙個序列 sequence create sequence example sequence increment by 1 每次加...

Oracle自增ID實現

首先,建立一張表 create table example id number 4 not null primary key,name varchar 25 然後,自定義乙個序列 sequence create sequence example sequence increment by 1 每次加...