Abnormal problems encountered when using Dameng database

Abnormal problems encountered by Dameng database

insert image description here

dm.jdbc.driver.DMException: Data conversion loss warning

My problematic SQL statement here is:

        MERGE INTO GOODS.DDZUSER t1
        USING(
        <foreach collection="list" item="item" index="index" separator="UNION ALL">
            SELECT
            #{item.name} name,
            #{item.tm} tm,
            #{item.rz} rz
            FROM dual
        </foreach>
        ) t2 ON (t1.name = t2.name and t1.tm = t2.tm )
        WHEN NOT MATCHED THEN INSERT
        (STCD, TM, RZ,  DTUPTM)
        VALUES
        (t2.name, t2.tm, t2.rz,  sysdate())
        WHEN MATCHED THEN UPDATE SET
       t1.tm=t2.tm, t1.rz=t2.rz, t1.dtuptm=sysdate()

Reason : It is because the data in the rz field in the list collection exceeds the length of the field type DEC(7,3) set by Damengku.

dm.jdbc.driver.DMException: Data not found

When using Dameng database to insert or update data in batches, I reported an error that I had never encountered before. At that time, there were only a few pieces of data that could not be inserted in the batch of data I gave. I checked the syntax and data types. There is no problem; when I got here, people were numb, and the only abnormality reported by the code was that the data was not found. Later, when I got the data and executed it in the SQL tool, I found that there was a trigger that reported an error; this trigger, every time new data is added Every time, it will check whether there is data in other tables according to a field inserted. Later, this trigger is disabled, and all data can be inserted normally.
Record it this time, so as to avoid the same problem next time, you can use it as a reference.

trigger, trigger, trigger

dm.jdbc.driver.DMException: String truncated

The reason why I have this exception is that the length of a field exceeds the character length set in the database table when inserting data.

Guess you like

Origin blog.csdn.net/weixin_45626288/article/details/132104224