Prepared statement and SQL functions
- From: Steve <root@xxxxxxxxx>
- Date: Sun, 19 Feb 2006 23:09:46 GMT
Hi,
I'm using a PreparedStatement for an INSERT operation and can set the values
of ints and strings using the .set* methods.
But some of the parameters are function calls to be executed at the database
server.
Example: I want to end up with:
"INSERT INTO table ( id, name, last_update ) VALUES ( 1, 'Fred', NOW() )"
[ NOW() is a MySQL function that returns the current date ]
PreparedStatement ps = conn.prepareStatement(
"INSERT INTO table ( id, name, last_update ) VALUES ( ?, ?, ? )" );
ps.setInt( 1, new Integer( 1 ) );
ps.setString( 2, new String( "Fred" ) );
.... What do I do for parameter 3?
Thanks for any help.
--
Regards,
Steve
"...which means he created the heaven and the earth... in the DARK! How good
is that?"
.
- Follow-Ups:
- Re: Prepared statement and SQL functions
- From: Joe Weinstein
- Re: Prepared statement and SQL functions
- From: Alan Krueger
- Re: Prepared statement and SQL functions
- Prev by Date: Re: applet not initialized
- Next by Date: Re: Prepared statement and SQL functions
- Previous by thread: applet not initialized
- Next by thread: Re: Prepared statement and SQL functions
- Index(es):
Relevant Pages
|
|