创建自增长序列(可以用sql创建也可以用工具Navicat)
sql创建序列(Sequences)(注意序列名用小写,不然会提示不存在)
CREATE SEQUENCE "public"."process_time_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 999999999
START 1
CACHE 1;
SELECT setval('"public"."process_time_seq"', 1, false);
ALTER SEQUENCE "public"."process_time_seq" OWNER TO "postgres";
Navicat创建序列(Sequences):
-- 查询序列:
SELECT nextval('process_time_seq');
--为主键设置Sequences:
alter table "public"."MACHINE_PROCESS_TIME" alter column "ID" set default nextval('process_time_seq');
--放入XML中
insert into "MACHINE_PROCESS_TIME" (
"ID",
"FACTORY_ID",
"WORKSHOP_ID",
"LINE_ID",
"STATION_ID",
"PROCESS_TIME",
"PROCESS_DATE",
"CREATE_DATE")values(
nextval('process_time_seq'),
#{factoryId,jdbcType=INTEGER},
#{workshopId,jdbcType=INTEGER},
#{lineId,jdbcType=INTEGER},
#{stationId,jdbcType=VARCHAR},
#{processtime,jdbcType=FLOAT},
#{processDate,jdbcType=DATE},
Now())
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。