(1)create table Your_Table(
Hm Number unique,
Other Char(10));
(2)建序列号
CREATE SEQUENCE your_sequence
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOCYCLE
CACHE 10;
(2)建触发器
CREATE TRIGGER autoinc BEFORE INSERT ON your_table
FOR EACH ROW
DECLARE
Hm Integer;
BEGIN
select your_sequence.nextval into Hm from dual;
new_hm := hm;
END;
/
create trigger your_trg before insert on your_table
for each row
declare
hm integer;
begin
select your_sequence.nextval into hm from dual;
:new.bh := hm; //bh为你的自动增加字段
end;