Some versions of Oracle are smart enough to figure out they're the same
(starting with 9i I think). However, the:
INSERT INTO mytable VALUES('a','B','CC');
is replaced by
INSERT INTO mytable VALUES(:1,:2,:3); // In database-speak
if you use a PreparedStatement object with ? where the bind variables go
so the statement parsed is really something like the third one, which is the
same in both your examples (just the values changed)...
-Dan
[EMAIL PROTECTED]
http://www.compuware.com/products/devpartner/db/oracle_debug.htm
> -----Original Message-----
> From: Jason Kilgrow [mailto:[EMAIL PROTECTED]]
>
> I can only assume that this applies to PreparedStatements as well.
> For instance, Oracle says that:
> INSERT INTO mytable VALUES('a','B','CC');
> is different than
> INSERT INTO mytable VALUES('d','E','FF');
> Therefore, the second query has to be reparsed/recompiled. No? That's
> my apprehension about using PreparedStatement. But, I guess Oracle is
> magic enough to see the similarities and cache the query enough so
> that only a parameter replacement takes place.
>
> Unless...unless it treats the question marks like ampersands (&) in
> the SQL...then that would make sense to me because then Oracle will
> ask for replacement values for each question mark much the same as it
> would if you were executing the query with & in place of ? in
> SQLPlus. I'm just guessing at this point, however.
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm
>
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm