序列
– Create sequence
create sequence SEQ_MKDD_ZPWSBFJHTY_ID
minvalue 1
maxvalue 999999999
start with 1
increment by 1
cache 20;
触发器
CREATE OR REPLACE TRIGGER “MKDD_ZPWSBFJHTY_TIGGER” BEFORE INSERT ON “MKDD_ZPWSBFJHTY” REFERENCING OLD AS “OLD” NEW AS “NEW” FOR EACH ROW DECLARE
NEXTID NUMBER;
BEGIN
IF :NEW.ID IS NULL OR :NEW.ID=0 THEN
SELECT SEQ_MKDD_ZPWSBFJHTY_ID.NEXTVAL INTO NEXTID FROM DUAL;
:NEW.ID:=NEXTID;
END IF;
END;
xml
INSERT INTO mkdd_zpwsbfjhty select SEQ_MKDD_ZPWSBFJHTY_ID.nextval as id from dual id, unit, tyear, tdate, triptime, tripline, protections, reclosing, disposition, operaunit <if test ='null != id'>
#{id},
</if>
<if test ='null != unit'>
#{unit},
</if>
<if test ='null != tyear'>
#{tyear},
</if>
<if test ='null != tdate'>
#{tdate},
</if>
<if test ='null != triptime'>
#{triptime},
</if>
<if test ='null != tripline'>
#{tripline},
</if>
<if test ='null != protections'>
#{protections},
</if>
<if test ='null != reclosing'>
#{reclosing},
</if>
<if test ='null != disposition'>
#{disposition},
</if>
<if test ='null != operaunit'>
#{operaunit}
</if>
</trim>
</insert>