OK,

I found it in the docs- but to tell the truth, I wouldn't understand it
without my knowledge now. 
It REALLY should be stated clearly, that the default CHANGES THE PARAMETERS
- btw, I still don't understand why. I think this is really an important
issue, that parameters are AUTOMATICALLY changed, and that should be stated
as clearly as possible. There should be a warning in DBI too, because that's
the first place to look for most people.

Frank

-----Original Message-----
From: Michael A Chase tech [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 25, 2004 3:07 AM
To: Steinhauer, Frank (CAM)
Cc: '[EMAIL PROTECTED]'
Subject: Re: prepared statement: automatically removed trailing spaces


On 11/24/2004 04:55 AM, Steinhauer, Frank (CAM) said:

...
> What actually happens is that the default binding for DBD::Oracle is
> SQL_VARCHAR. When Oracle OCI sees that type, it automatically strips
> trailing spaces leaving '' if that's all there was. Then '' is interpreted
> as a NULL by Oracle. Binding as SQL_CHAR prevents the space stripping. 
> ...
> See
>
http://groups.google.com/groups?hl=en&lr=&threadm=E3A8A8F741B2D611ACA800508B
>
6F33D4381467%40chitmd03.nt.il.nbgfn.com&rnum=2&prev=/groups%3Fq%3Dbind_param
>
%2Bspace%26hl%3Den%26lr%3D%26selm%3DE3A8A8F741B2D611ACA800508B6F33D4381467%2
> 540chitmd03.nt.il.nbgfn.com%26rnum%3D2
> 
> Why there is no hint about something important like that in the
> documentation of DBI and DBD-Oracle? I think that's a really important
> issue!!!

It's been a basic problem with Oracle since forever that it treats '' as 
NULL.

The automatic removal of trailing spaces is mentioned in `perldoc 
DBD::Oracle` or http://search.cpan.org/dist/DBD-Oracle/Oracle.pm. 
Search for ora_ph_type.

=====
ora_ph_type

The default placeholder data type for the database session. The TYPE or 
"ora_type" attributes to "bind_param" in DBI and "bind_param_inout" in 
DBI override the data type for individual placeholders. The most 
frequent reason for using this attribute is to permit trailing spaces in 
values passed by placeholders.
=====

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Cthulhu in 2004.  Don't settle for the lesser evil.

Reply via email to