[unixODBC-support] Extra spaces in the query result
nick.gorham at easysoft.com
Wed Jun 28 09:10:22 BST 2006
Nagesh Sharvari-A21337 wrote:
> I am using Oracle driver from easy soft and the problem is, when
>I execute stored procedures, in the varchar type OUT parameters, extra
>spaces are added at the end. For Example, if the buffer size is 30, and
>the value length is only 10, then 20 extra spaces are getting added
>after the actual value.
>This is making my validation scripts to fail.
>Here is an example of bind command I am using:
>#define MSMDN_COLSIZE 30
>SQLINTEGER strlenMdn = SQL_NTS;
> (SQLCHAR *)msmdn,
>Here the column size is 30bytes and even the buffer size is 30 bytes.
>But Since this is a varchar, the actual size of the value is only 10
>bytes. ODBC is filling extra spaces at the end of the buffer.
>Please help me solve this.
This is because Oracle allows nulls to be embedded in a string, so the
driver returns the length Oracle reports. There is an option to make the
driver behave like you may expect for a Varchar, add
VarcharTrimTrailingSpaces = 1
to the DSN ini entry.
BTW, this list is for unixODBC support, the Easysoft driver isn't part
of unixODBC, As it happens I can answer for both, but the correct place
for Easysoft driver questions is support at easysoft.com
More information about the unixODBC-support