1.
select * from s_hrdata
2. 创建Sequence:
create sequence s_hrdata_SEQUENCE start with 1 increment by 1
3.创建Trigger:
CREATE OR REPLACE TRIGGER s_hrdata_trgger
BEFORE INSERT OR UPDATE OF ID
ON s_hrdata
FOR EACH ROW
BEGIN
SELECT s_hrdata_SEQUENCE.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
在插入数据的时候就不用提供id了。
insert into s_hrdata(c_xm,c_xb,c_sfzh,c_ygbh,c_qdbm,c_ssjg,c_sgid,c_zwgw,c_zzzt,c_rzsj,c_tbsj,c_czlx)
values('liangjm','m','110102195510018316','AB005618','df','sddd','cc','dd',1,sysdate,sysdate,'ter');
select * from s_hrdata
select * from s_hrdata
2. 创建Sequence:
create sequence s_hrdata_SEQUENCE start with 1 increment by 1
3.创建Trigger:
CREATE OR REPLACE TRIGGER s_hrdata_trgger
BEFORE INSERT OR UPDATE OF ID
ON s_hrdata
FOR EACH ROW
BEGIN
SELECT s_hrdata_SEQUENCE.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
在插入数据的时候就不用提供id了。
insert into s_hrdata(c_xm,c_xb,c_sfzh,c_ygbh,c_qdbm,c_ssjg,c_sgid,c_zwgw,c_zzzt,c_rzsj,c_tbsj,c_czlx)
values('liangjm','m','110102195510018316','AB005618','df','sddd','cc','dd',1,sysdate,sysdate,'ter');
select * from s_hrdata