 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Roedy Green Guest
|
Posted: Sat Jun 12, 2004 3:45 am Post subject: PreparedStatement |
|
|
In PreparedStatement, are ? only for replacing data values is there
some way to use them to modify operators e.g. swap < for > or insert
keywords such as DESC?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
|
| Back to top |
|
 |
Joe Weinstein Guest
|
Posted: Sat Jun 12, 2004 6:09 am Post subject: Re: PreparedStatement |
|
|
Roedy Green wrote:
| Quote: | In PreparedStatement, are ? only for replacing data values is there
some way to use them to modify operators e.g. swap < for > or insert
keywords such as DESC?
|
Only for single data values. The intention is that the SQL be complete
enough that the DBMS can compile it and decide on the correct query plan
for repeated execution with whatever values are plugged in, like a stored
procedure with parameters. '?'s can't be used (though many try) to swap
in various parts of the actual SQL syntax, but this would define/alter the
query plan, so there would be no precompilation for reuse, so there would
be no advantage over simply constructing the SQL string at the client and
sending it fresh for every execution.
Joe Weinstein at BEA
|
|
| Back to top |
|
 |
Chuck Simpson Guest
|
Posted: Sat Jun 12, 2004 6:11 pm Post subject: Re: PreparedStatement |
|
|
On Sat, 12 Jun 2004 03:45:33 +0000, Roedy Green wrote:
| Quote: | In PreparedStatement, are ? only for replacing data values is there some
way to use them to modify operators e.g. swap < for > or insert keywords
such as DESC?
|
The bind markers, ?, are only for data values. They can be used in a
where clause, in a select expression list, on the RHS of a set expression
and in a procedure or function call for input values. Also as a function
return value marker and OUT parameter markers in stored function or
procedure calls. You have to register OUT parameters including any return
value in a stored procedure or function call so these are markers for
output data or input and output data if a parameter is IN OUT.
Chuck
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|