For shame - no binds?
Ian Bird, June 21, 2004 - 7:38 am UTC
Tom
Would it not be better if it were something like:
> cat char_with_binds.sh
sqlplus -s scott/tiger << EOF
variable my_var varchar2(100)
begin :my_var := '$1'; end;
/
select :my_var with_binds from dual;
exit
EOF
> char_with_binds.sh "Hello World"
PL/SQL procedure successfully completed.
WITH_BINDS
---------------------------------------------------------
Hello World
Othewise it would be breaking your Mantra n'est pas? 'Always use bind variables.'
Regards
Ian
June 21, 2004 - 8:41 am UTC
begin :my_var := '$1'; end;
/
would generate just as many unique SQL's. that plsql block would be hard parsed.
a script like this would benefit from
alter session set cursor_sharing=force;
if the input value changes (if the environment variable is constantly changing)
Doh!
Ian, June 21, 2004 - 1:14 pm UTC
That will teach me! Obvious now you point it out.
Just proves that sometimes when you test you see the result you want to see. I was happily proving to myself that there was only one statement in v$sqlarea with the with_binds string - completely missed all the begin :my_var := whatever statements.
Thanks for putting me right - will try again with alter session set cursor_sharing=force;
Thanks and Regards
Ian