Hello,

I had for some days a problem using a prepared statement. One value was
simply a space, the row had a NOT NULL constraint, and i always got the
error message "... cannot insert NULL into ... (DBD ERROR: OCIStmtExecute)".
Well, after more than two days trying to specify the problem and then to fix
it, I found following in the newsgroup perl.dbi.users:

From: Michael A Chase ([EMAIL PROTECTED])
Subject: Re: inserting a single space into a non NULL field aborts with
error 
Newsgroups: perl.dbi.users
...
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!!!



Regards,

Frank 


PS:
I'm using DBI 1.30 and Oracle 9i, but I think this problem is version
immanent (there's no hint in the DBI or DBD-Oracle releasenotes/changes
about something like this)

Reply via email to