pgsql数据库创建序列
最近在做项目的时候,老核心使用的是oracle数据库
--oracle数据库查看序列
select seq_surrender_fee_rate.nextval from dual;
然后按住CTRL键点击上面的序列,
然后将这个sql,复制粘贴到pgsql数据库中,运行,就能够在pgsql数据库创建相应的序列了。
mybatis插入语句写法:
<insert id="insert" parameterType="com.picc.hmims.questionnaire.dto.PublicAnswerEntity"> <selectKey keyProperty="publicAnswerId" resultType="String" order="BEFORE"> select nextval('t_public_answer_id_seq') </selectKey> insert into t_public_answer ( public_answer_id, public_question_id, answer_option, option_code, option_code_desc, answer_seq, default_flag, max_length, default_input, max_value, min_value, remark, insert_oper, insert_time, update_time, update_oper ) values ( cast(#{publicAnswerId} as numeric), -- nextval('t_public_answer_id_seq'), cast(#{publicQuestionId}as numeric), #{answerOption}, #{optionCode}, #{optionCodeDesc}, cast(#{answerSeq}as numeric), #{defaultFlag}, #{maxLength}, #{defaultInput}, cast(#{maxValue}as numeric), cast(#{minValue}as numeric), #{remark}, #{insertOper}, to_date(#{insertTime,jdbcType=VARCHAR},'YYYY-MM-DD HH24:MI:SS'), #{updateTime}, #{updateOper} ) </insert>