473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

MERGE statement using PreparedStatement in JAVA

Hello

I\\\'m new to DB2 and I\\\'ve been trying to create the MERGE statement using PreparedStatements in Java as a requirement for a project I\\\'m working on, but I get the following message:

DB2 SQL error: SQLCODE: -418, SQLSTATE: 42610, SQLERRMC: null

The statements I am creating are very long but here is a short example of the the statements I am using:

MERGE INTO schema.tableName USING
( VALUES ( ?, ?, ?, ?)) as lb ON (primaryKeyField = ?)
WHEN MATCHED THEN UPDATE
SET field2 = ?, field3 = ?, field4 = ?
WHEN NOT MATCHED THEN
INSERT(primaryKeyField, field2, field3, field4)
VALUES(?,?,?,?)

I\\\'ve already tested that each value is assigned to the corresponding parameter.
Do I have to use the CAST operator on every value in the SET clause? What exactly is causing the error?

Thanks in advance. Have a good day

Robert
May 1 '07 #1
0 2700

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action...
2
by: Paul Reddin | last post by:
Hi, (V8.1 Fp2) Our application uses JDBC batch to execute mutiple insert statements and we saw a strange thing this morning. There were 4 SQL Insert statements in the batch, and we know the...
1
by: alan_sec | last post by:
I' m sending query to DB2 7.2 (installed on Win 2000) using JDBC driver COM.ibm.db2.jdbc.net.DB2Driver like this: String query = "SELECT dercert from vacert " + "WHERE vrijediod=(select...
2
by: vasilip | last post by:
I am trying to use the XMLUPDATE stored procedure. Installed fine, and seems to work great if I execute the statement from a sql query using the controll center.. Doesn't work from java however. I...
8
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive...
1
by: robtyketto | last post by:
Greetings, After changing all my jsp code to use Prepared statements I have an error in the below code. The error is as follows:- It doesnt appear related at all, line position isnt...
3
by: aj | last post by:
DB2 LUW 8.1 fixpak 14 Red Hat EL AS 4.4 I'm trying to diagnose some nocturnal CPU pressure, and am trying to understand the dynamic statement cache as it applies to LUW. The only doc/redbooks...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
0
by: rajkumargnv | last post by:
I know there are differences in MERGE Statement in UDB and z/OS like in z/Os only one 'WHEN MATCHED', one 'WHEN NOT MATCHED' are allowed. My question is more about USING clause, does it always...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.