prepared statement: automatically removed trailing spaces
From: Frank Steinhauer (Frank.Steinhauer.External_at_eads.com)
Date: 11/24/04
- Next message: Mark Martin: "Re: Why wont my script finish?"
- Previous message: Martin Hall: "Re: DBD::Oracle problem with include files"
- Next in thread: Michael A Chase tech: "Re: prepared statement: automatically removed trailing spaces"
- Reply: Michael A Chase tech: "Re: prepared statement: automatically removed trailing spaces"
- Maybe reply: Frank Steinhauer: "Re: RE: prepared statement: automatically removed trailing spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: "'dbi-users@perl.org'" <dbi-users@perl.org> Date: Wed, 24 Nov 2004 13:55:43 +0100
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 (mchase@ix.netcom.com)
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)
- Next message: Mark Martin: "Re: Why wont my script finish?"
- Previous message: Martin Hall: "Re: DBD::Oracle problem with include files"
- Next in thread: Michael A Chase tech: "Re: prepared statement: automatically removed trailing spaces"
- Reply: Michael A Chase tech: "Re: prepared statement: automatically removed trailing spaces"
- Maybe reply: Frank Steinhauer: "Re: RE: prepared statement: automatically removed trailing spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|