码迷,mamicode.com
首页 > 其他好文 > 详细

function to_timestamp(timestamp without time zone, unknown) does not exist

时间:2020-03-30 21:35:37      阅读:493      评论:0      收藏:0      [点我收藏+]

标签:status   varchar   div   比较   ase   百度   就会   isa   数据库   

公司的项目使用的是pgsql数据库,我也不是到为什么不把数据库表字段都设计成varchar的,现在搞的数据库的字段类型比较多,在执行sql语句的时候,就会报各种各样的错误,这不:function to_timestamp(timestamp without time zone, unknown) does not exist一个问题,解决办法:

这是自己百度来的:(经过自己修改)

<select id="getList" resultMap="productResult" parameterType="map">
        select distinct
        tp.PRODUCT_ID,tp.IS_SHUT_APPLY,tp.IMPL_TYPE,tp.PRODUCT_CODE,tp.PRODUCT_NAME,tp.PRODUCT_TASK_STATUS,tp.IS_ABLE,tp.PRODUCT_TYPE,tp.IS_INSURECE,tp.INS_PRODUCT_CODE,tp.INS_PRODUCT_NAME,
        tp.PERIOD_OPTION,tp.PERIOD,tp.PERIOD_UNIT,to_date(tp.PERIOD_END_DATE::text,‘YYYY-MM-DD‘)
        PERIOD_END_DATE
        ,case when ((now() >=
        tp.start_date
        and to_date(tp.end_date::text,‘YYYY-MM-DD‘) +1>=
        now()) or (tp.end_date is null and now() >=
        tp.start_date)) then
        ‘01‘ else ‘00‘ end as
        PRODUCT_STATUS,to_date(tp.START_DATE::text,‘YYYY-MM-DD‘)
        START_DATE,to_date(tp.END_DATE::text,‘YYYY-MM-DD‘)
        END_DATE,tp.IS_DOC,tp.PRICE,tp.COST_PERCENT COST_PERCENT,
        tp.SALES_COST_PERCENT SALES_COST_PERCENT,
        tp.MNT_COST_PERCENT
        MNT_COST_PERCENT
        ,tp.TAX_PERCENT TAX_PERCENT
        ,tp.PROFIT_PERCENT
        PROFIT_PERCENT,tp.EXPLAIN,tp.ORG_CODE,
        INSERT_OPER,to_date(tp.INSERT_TIME::text,‘YYYY-MM-DD‘),
        INSERT_TIME,to_date(tp.UPDATE_TIME::text,‘YYYY-MM-DD‘),
        UPDATE_TIME,tp.UPDATE_OPER
        from t_product tp
        join t_product_org tpo on
        tp.product_code=tpo.product_code and (tpo.org_code like ‘${orgCode}%‘
        or tpo.org_code = ‘86‘)
        where
        1=1
        <if test="productCode != null and productCode != ‘‘">
            AND tp.PRODUCT_CODE = #{productCode,jdbcType=VARCHAR}
        </if>
        <if test="productStatus eq ‘01‘">
            AND ((now() >=
            tp.start_date
            and tp.end_date + 1>=
            now()) or (tp.end_date is null and now() >=
            tp.start_date))
        </if>
        <if test="productStatus eq ‘00‘">
            AND (tp.start_date >
            now()
            or now > tp.end_date)
        </if>
        <if test="productTaskStatus != null and productTaskStatus != ‘‘">
            AND tp.PRODUCT_TASK_STATUS =
            #{productTaskStatus,jdbcType=VARCHAR}
        </if>
        <if test="productType != null and productType != ‘‘">
            AND tp.PRODUCT_TYPE = #{productType,jdbcType=VARCHAR}
        </if>
        <if test="isDoc != null and isDoc != ‘‘">
            AND tp.IS_DOC = #{isDoc,jdbcType=VARCHAR}
        </if>
        <if test="isInsurece != null and isInsurece != ‘‘">
            AND tp.IS_INSURECE = #{isInsurece,jdbcType=VARCHAR}
        </if>
        <if test="isAble != null and isAble != ‘‘">
            AND tp.IS_ABLE = #{isAble,jdbcType=VARCHAR}
        </if>
        order by tp.product_code
    </select>

自己对底层的东西也不是很懂,只能是遇到一个问题,百度一个问题了,看来下来找时间一定要多研究一下底层的东西了。

 

function to_timestamp(timestamp without time zone, unknown) does not exist

标签:status   varchar   div   比较   ase   百度   就会   isa   数据库   

原文地址:https://www.cnblogs.com/dongyaotou/p/12601157.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!