I'm using org.springframework.jdbc.core.JdbcTemplate to execute a sentence like this. The SQL Times is wrong:
INSERT into Customerbranch
(ID, optimistic, frp_id, Paymentchannel, customer_id, bank_id, UpdateTime)
SELECT NEXT VALUE for Customerbranch_id_sequence,
0, 1005, ' NET ',?, BankID, Current_timestamp
From (SELECT DISTINCT f.bank_id as BankID
From Frpbusiness FB, FRP F
where f.id = Fb.id and FB. Business in (' DEBIT ', ' credits ', ' business-to-business ')
)
The main error message is this:
COM.IBM.DB2.JCC.C.SQLEXCEPTION:DB2 SQL error:sqlcode: -418, sqlstate:42610, Sqlerrmc:null
But strangely, I was in the dbeaver, and when I replaced it with a parameter, I was able to do it normally.
Baidu for a long time, find such a question and answer: http://www.itpub.net/thread-1249543-1-1.html
One of them mentions: "Can't have in select list"? ' Bar '
Then I'll replace the one in SQL with the actual argument and execute it again in the code, which is OK.
Select? From ... Is the usual notation I used to use MyBatis. But the JdbcTemplate cannot write like this.
This article is from the "Programming Capricorn Man" blog, make sure to keep this source http://winters1224.blog.51cto.com/3021203/1579384
Database error: SQLCODE: -418, sqlstate:42610, Sqlerrmc:null