Java Prepared Statement with multiple arguments
- From: johnfofawn@xxxxxxxxxxx
- Date: 3 Aug 2005 07:47:48 -0700
Hi,
I need to insert data into a table only if that data does not already
exist.
So I want to do something like
IF NOT EXIST (SELECT * FROM MyTable WHERE MyColumn = '?') INSERT INTO
MyTable (MyColumn) VALUES ('?')
In this example there is only one column, but in my real table I have
about 10 columns.
So I can create a prepared statement to do this, but since I use two
?'s for each column (one for the select and another for the insert) I
have to set each column value twice.
Am I using this right? Is there a better way to do this?
THANKS!
John
.
- Follow-Ups:
- Re: Java Prepared Statement with multiple arguments
- From: joeNOSPAM@xxxxxxx
- Re: Java Prepared Statement with multiple arguments
- Prev by Date: How to store images into HypersonicSQL database?
- Next by Date: Differentiating between results of getSchemas()
- Previous by thread: How to store images into HypersonicSQL database?
- Next by thread: Re: Java Prepared Statement with multiple arguments
- Index(es):
Relevant Pages
|
|