develooper Front page | perl.dbi.users | Postings from August 2006

Re: Minor gotcha with bind variables and type CHAR.

Thread Previous | Thread Next
From:
Peter J. Holzer
Date:
August 14, 2006 01:26
Subject:
Re: Minor gotcha with bind variables and type CHAR.
Message ID:
20060814082552.GD22349@wsr.ac.at
On 2006-08-11 18:25:39 -0700, Stephen Carville wrote:
> Michael.Coll-Barth@VerizonWireless.com wrote:
> >I would expect to have to pad the field in my where clause against a
> >char field, regardless of how I submitted the query to Oracle.
> 
> Until I switched to using bind variables, I'd never had a problem.
> Trimmed fields compared fine to CHAR and VARCHAR2 alike.

I think Oracle pads the string with spaces if you don't use
placeholders. You can get it to do that with placeholders, too, if you
explicitely bind the variables (there are several char types, and one of
them does the padding). There have been occasional discussions about
this behaviour over the years, and so far nobody could come up with a
method which "does the right thing" in all cases - the current behaviour
is the one which is least surprising in most cases.

	hp

-- 
   _  | Peter J. Holzer    | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR       | I'd be programming in Java.
| |   | hjp@wsr.ac.at      | I don't, and I'm not.
__/   | http://www.hjp.at/ |   -- Jesse Erlbaum on dbi-users

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About