postgreSQL alter column data type to timestamp without time zone

现在公司数据访问层用的是mybatis框架,数据库用的pgsql,其中日期字段指定的是timestamp类型的。实体类是String类型的。

现在在执行更新操作的时候报这个错误:postgreSQL alter column data type to timestamp without time zone

以后要一定要多注意,报错的提示信息,其实上面就有交给你怎样进行修改,修改后的sql语句:

<update id="updateProductService"  parameterType="com.picc.hmims.productInfo.dto.ProductServiceBo">
        update t_product_service
        <set>
            <if test="productId != null" >
                product_id=cast(#{productId} as NUMERIC ),
            </if>
            <if test="parentServiceId != null" >
                parent_service_id=cast(#{parentServiceId} as NUMERIC ),
            </if>
            <if test="serviceId != null" >
                service_id=cast(#{serviceId} as NUMERIC ),
            </if>
            <if test="exeOrder != null" >
                exe_order=cast(#{exeOrder} as NUMERIC ),
            </if>
            <if test="serviceCode != null" >
                service_code=#{serviceCode},
            </if>
            <if test="serviceName != null" >
                service_name=#{serviceName},
            </if>
            <if test="chargingWay != null" >
                charging_way=#{chargingWay},
            </if>
            <if test="availableAmount != null" >
                available_amount=cast(#{availableAmount} as NUMERIC ),
            </if>
            <if test="amountUnit != null" >
                amount_unit=#{amountUnit},
            </if>
            <if test="priceOption != null" >
                price_option=#{priceOption},
            </if>
            <if test="price != null" >
                price=cast(#{price} as NUMERIC ),
            </if>
            <if test="cost != null" >
                cost=cast(#{cost} as NUMERIC ),
            </if>
            <if test="probabilityCost != null" >
                probability_cost=cast(#{probabilityCost} as NUMERIC ),
            </if>
            <if test="limitType != null" >
                limit_type=#{limitType},
            </if>
            <if test="isWaitingPeriod != null" >
                is_waiting_period=#{isWaitingPeriod},
            </if>
            <if test="waitingPeriod != null" >
                waiting_period=cast(#{waitingPeriod} as NUMERIC ),
            </if>
            <if test="serviceOption != null" >
                service_option=#{serviceOption},
            </if>
            <if test="serviceAppoint != null" >
                service_appoint=#{serviceAppoint},
            </if>
            <if test="serviceNum != null" >
                service_num=cast(#{serviceNum} as NUMERIC ),
            </if>
            <if test="serviceType != null" >
                service_type=#{serviceType},
            </if>
            <if test="serviceWay != null" >
                service_way=#{serviceWay},
            </if>
            <if test="insertOper != null" >
                insert_oper=#{insertOper},
            </if>
            <if test="insertTime != null" >

                insert_time=TO_TIMESTAMP(#{insertTime}, ‘yyyy-MM-ddTHH24:mm:ss.SSSZ‘),
            </if>
            <if test="updateTime != null" >

                update_time=TO_TIMESTAMP(#{updateTime}, ‘yyyy-MM-ddTHH24:mm:ss.SSSZ‘),
            </if>
            <if test="updateOper != null" >
                update_oper=#{updateOper},
            </if>
            <if test="balanceType != null" >
                balance_type=#{balanceType},
            </if>
            <if test="servicePriceOption != null" >
                service_price_option=#{servicePriceOption}
            </if>
        </set>
        where product_service_id = cast(#{productServiceId} as NUMERIC )
    </update>

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

时间: 2024-11-07 11:51:31

postgreSQL alter column data type to timestamp without time zone的相关文章

PostgreSQL - invalid input syntax for type timestamp with time zone

问题 在执行以下sql时报错: select COALESCE(null,null,now(),''); 报错如下: SQL Error [22007]: ERROR: invalid input syntax for type timestamp with time zone: "" Position: 33 org.postgresql.util.PSQLException: ERROR: invalid input syntax for type timestamp with t

PostgreSQL ALTER TABLE中改变数据类型时USING的用法&lt;转&gt;

在修改表字段类型的时候使用Using来进行显示的转换类型. 原文说明: SET DATA TYPE  This form changes the type of a column of a table. Indexes and simple table constraints involving the column willbe automatically converted to use the new column type by reparsing the originally supp

7.1The ISO SQL Data Type

In this section we introduce the data types defined in the SQL standard. We start by defining what constitutes a vailed identifer in SQL. 7.1.1  SQL Identifiers SQL identifiers are identify objects in the database, such as table names, views names, a

nodes() Method (xml Data Type)

https://docs.microsoft.com/en-us/sql/t-sql/xml/nodes-method-xml-data-type The nodes() method is useful when you want to shred an xml data type instance into relational data. It allows you to identify nodes that will be mapped into a new row. Every xm

SQL Server error &quot;Xml data type is not supported in distributed queries&quot; and workaround for it

Recently while working with data migration,got an error while running a following query where Server2 has beed added as linked server. SELECT * FROM Server1.Database1.dbo.Table1 WHERE Column1 NOT IN (SELECT Column1 FROM Server2.Database2.dbo.Table1)

From data type varchar to varbinary is not allowed

The issue: insert into tb_Admin values (1,111, 'ricky',1234)Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query. Root Cause: the column 'AdminName' define as varbinary. --The table struct

PHP 笔记一(systax/variables/echo/print/Data Type)

PHP stands for "Hypertext Preprocessor" ,it is a server scripting language. What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send an

Linux C double linked for any data type

/************************************************************************** * Linux C double linked for any data type * 声明: * 提供一种双链接口,可以保存保存任何类型的数据. * * 2015-12-25 晴 深圳 南山平山村 曾剑锋 **********************************************************************

MSSql Server 索引&#39;uq_f_userName&#39; 依赖于 列&#39;f_userName&#39;。由于一个或多个对象访问此列,ALTER TABLE ALTER COLUMN f_userName 失败

--需求有变,需要往t_login表的f_userName字段添加外国人名,之前设置的varchar(10)不够,商议决定改成varchar(30),执行的时候,提示消息 索引'uq_f_userName' 依赖于 列'f_userName'.由于一个或多个对象访问此列,ALTER TABLE ALTER COLUMN f_userName 失败.--原来,之前为了防止f_userName重复,添加了唯一索引uq_f_userName.--进行如下操作后,问题妥妥解决--表名:t_login(登