Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: OCIBind and whitespace trimming

Re: OCIBind and whitespace trimming

From: Mark Bole <makbo_at_pacbell.net>
Date: Sat, 21 Feb 2004 14:29:38 GMT
Message-ID: <mXJZb.15734$dS2.1586@newssvr29.news.prodigy.com>


Rene Nyffenegger wrote:

>>Rene Nyffenegger <rene.nyffenegger_at_gmx.ch> wrote in message news:<c0sic1$1b5jo4$1_at_ID-82536.news.uni-berlin.de>...
>>
>>>>Hi everyone. I've got a customer that is using some older code we
>>>>wrote to update some tables (code based on OCI from 8.1.7). One
>>>>particular table has a VARCHAR2 field and he wants to put the
>>>>following text into it: 'this is my test '. Note the space at the
>>>>end. Our little helper function uses OCIBindByPos when building the
>>>>Update clause and this, it turns out, causes the trailing spaces to
>>>>get stripped:
>>>>

[...]

> 
> What datatype did you state in the OCIBindByPos function call?
> 
> Rene
> 
> 

There is something called 'blank-padded comparison semantics' (you can search for this at tahiti.oracle.com).

It seems to boil down to whether you are using CHAR or VARCHAR2 datatypes. I don't use OCI directly, but in DBD::Oracle module for Perl, which does use OCI, you have to set a specific parameter to control how this works (i.e. to not drop the trailing blanks).

--Mark Bole Received on Sat Feb 21 2004 - 08:29:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US