Database error: SQLCODE: -418, sqlstate:42610, Sqlerrmc:null

Source: Internet
Author: User
Tags db2 db2 sql error sql error

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/1570401

Database error: SQLCODE: -418, sqlstate:42610, Sqlerrmc:null

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.