Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.server -> Re: opinion solicited

Re: opinion solicited

From: Ed Stevens <nospam_at_noway.nohow>
Date: Fri, 09 Jul 2004 10:49:35 -0500
Message-ID: <>

On Fri, 09 Jul 2004 14:22:26 GMT, "Anurag Varma" <> wrote:

>"Ed Stevens" <nospam_at_noway.nohow> wrote in message
>> Yesterday I made a presentation to a group of our developers. The
>> subject was the use of bind variables to reduce parsing and latch
>> waits. I presented several demos based on those presented in Tom
>> Kyte's book, and provided coding examples for several different
>> programmnig environments.
>> Later, one of the participants sent me a link to a website whose
>> author acknowledged the problems of not using bind variables but
>> appeard to be making a case that, in practice, the various coding
>> environments (PL/SQL, java, etc.) took care of it for you. He (the
>> wesite author) went on to give coding examples where - oh, gee, he was
>> coding to use bind variables -- and saying that as long as you coded
>> this way, the programming environment would just take care of it for
>> you. I thought it was pretty misleading and gave the distinct
>> impression to a casual reader that the programmer really didn't need
>> to concern himself with the subject.
>> Link is at
>> I'd be curious to hear other people's take.
>hmm .. I don't really agree that the statements in that article/blog are misleading.
>He did give an example where even in PL/SQL you can write SQL which will
>not utilize bind variables.
>For Java/VB etc he says <quote>All of these APIs have built-in support for bind variables,
>and it's just a case of using this support rather than just concatenating a string yourself and
>submitting it to the database</quote>
>Which pretty much states that if you do not use the built in support for bind variables then
>you are *not* using bind variables.

True enough, but also makes statements like this:

"Taking PL/SQL first of all, the good news is that PL/SQL itself takes care of most of the issues to do with bind variables, to the point where most code that you write already uses bind variables without you knowing. "

Well. I guess that depends on what "most code that you write " looks like. A lot of programmers write a lot of code by simply replicating bits of (potentially bad) example code they found somewhere. Heck, a lot of DBA's create a lot of databases by simply replicating (potentially bad) examples they found somewhere.

I've actually heard a highly-paid consultant/instructor state that (1) Java doesn't support bind variables and (2) therefore, one should always set cursor_shareing=force. Well, to paraphrase a line from The Music Man, "I don't know much about Java, but I do know it supports bind variables." That may seem tangential to the discussion at hand, but I can easily see where some programmers would develop as their standard (and thinking it was a universal standard), practices that do not support bind variables.

Please don't think I'm trying to slam you or the blog author. I thought what he wrote was factually correct, but parts were a bit mis-leading, even if unintentional. Thought some commentary might be useful to lurkers, and certainly serves to sharpen my own thinking. Received on Fri Jul 09 2004 - 10:49:35 CDT

Original text of this message