Oracle id自动增长列

it2022-05-18  75

第一步:创建SEQUENCE     create   sequence   s_country_ id   increment   by   1   start   with   1   maxvalue   999999999;     第二步:创建一个基于该表的before   insert   触发器,在触发器中使用该SEQUENCE     create   or   replace   trigger   bef_ins_t_country_define     before   insert   on   t_country_define     referencing   old   as   old   new   as   new   for   each   row     begin     select   s_country_ id.nextval   into   :new.country_ id   from   dual;     end;   (insert 时就不用关心自动增长列了)

转载于:https://www.cnblogs.com/Fly-sky/archive/2008/09/27/1299996.html


最新回复(0)