Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: DBI Deletes with placeholders

by Thilosophy (Curate)
on Feb 05, 2008 at 06:00 UTC ( #666216=note: print w/ replies, xml ) Need Help??


in reply to DBI Deletes with placeholders

Corion prompted me to check the type of the column that I was using in the where clause. It was a CHAR(6). I was looking for a 5 character string. I padded the string with a trailing space and everything worked properly.

Yeah, that is a well-known issue on Oracle, making use of the CHAR type rather error-prone.

CHAR is a fixed length type, and all data gets padded with spaces. If you want to query the table, you also have to pad the constants in your WHERE clause accordingly, or they will not match. When directly interpolating into the SQL string (which is discouraged), Oracle will add the padding automatically, but when using bind variables, it will not. Unless your data is really fixed (and maybe even then) you should consider VARCHAR2.


Comment on Re: DBI Deletes with placeholders
Re^2: DBI Deletes with placeholders
by AKSHUN (Novice) on Feb 05, 2008 at 15:15 UTC
    Unfortunately, or fortunately depending on one's perspective, I don't get to make any design decisions on this database or table. Basically, it is how it is and I have to work with it. But again, I appreciate everyone's help.

    AKSHUN

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://666216]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-09-19 06:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (131 votes), past polls