0

In order to receive the parameters and update the data, I put the fake data in and run the update.

        UPDATE
        TB_PUSH_MESSAGE
        SET 1=1
        <if test="status != ''">
        , status = #{status}
        </if>
        <if test="body != null">
        , body = #{body}
        </if>
        WHERE
        seq_no = #{seq_no}

but it's get error

Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1=1 , status = '0'

          WHERE       seq_no = '1'' at line 3

How do I solve this problem if I can't put fake data in it?

str
  • 42,689
  • 17
  • 109
  • 127
helpmesolution
  • 83
  • 2
  • 11

1 Answers1

0

The problem seems to be your 1 = 1 statement. In this case, first 1 is treated as "column number one in the table TB_PUSH_MESSAGE". So you can read this line as set seq_no = 1, which is most probably incompatible with type of the column.

update equivalent of WHERE '1' = '1' — this question seems to be helpful/related/duplicate.

Dmitriy Popov
  • 2,150
  • 3
  • 25
  • 34