On 07/05/09 16:23, E R wrote:
Hi,

I have a situation where I need a number to be represented as a string
in a place holder:

my $x = 7553;

$dbh->do("SELECT * FROM PRODUCTS WHERE VENDOR = ?", {}, $x);

I'd like the above to be the same as: SELECT * FROM PRODUCTS WHERE
VENDOR = '7553'
The VENDOR column is a VARCHAR2, and Oracle won't use the index on
that column unless it is specified as a string.
However, it doesn't complain if VENDOR = 7553 is used.

See this link for more background info:
http://forums.oracle.com/forums/thread.jspa?messageID=3451942

Is there a way to ensure that the parameter is passed to Oracle as a string?

You do not say which perl driver your are using to talk to Oracle.
The DBD::Oracle driver binds all placeholders as strings by default.

Are you using DBD::Oracle?

--
Charles Jardine - Computing Service, University of Cambridge
c...@cam.ac.uk    Tel: +44 1223 334506, Fax: +44 1223 334679

Reply via email to