[unixODBC-support] Extra spaces in the query result

Nagesh Sharvari-A21337 sharvari.nagesh at motorola.com
Wed Jun 28 08:19:33 BST 2006


Hello,
	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:

char msmdn[30];
bzero(msmdn, sizeof(msmdn));
#define MSMDN_COLSIZE 30
SQLINTEGER     strlenMdn = SQL_NTS;
SQLBindParameter(stmt,
                 3,
                 SQL_PARAM_OUTPUT,
                 SQL_C_CHAR,
                 SQL_VARCHAR,
                 (SQLUINTEGER)MSMDN_COLSIZE,
                 0,
                 (SQLCHAR *)msmdn,
                 sizeof(msmdn),
                 &strlenMdn);


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.

Thanks and regards
Sharvari 




More information about the unixODBC-support mailing list