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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM