Feedback
Did this article resolve your question/issue?

   

Article

Incorrect VARCHAR column length returned when calling SQLDescribeCol().

Information

 
TitleIncorrect VARCHAR column length returned when calling SQLDescribeCol().
URL Nameproblems-obtaining-the-precision-of-two-columns
Article Number000180222
EnvironmentProduct: Connect for ODBC Oracle drivers
Version: 7.1
OS: Windows
Database: Oracle 12c
Application: All supported applications
Question/Problem Description
Incorrect VARCHAR column length returned when calling SQLDescribeCol() using the Connect for ODBC Oracle drivers.
Steps to Reproduce-Create table :

CREATE TABLE FASES_ALTA
(
ID_EMPLEADO VARCHAR(10) NOT NULL
)

-Prepare statement :

SELECT P.ID_EMPLEADO FROM FASES_ALTA P WHERE P.ID_EMPLEADO = ? GROUP BY P.ID_EMPLEADO

-Call SQLDescribeCol(ID_EMPLEADO) :

The result of SQLDescribeCol() shows 2000 instead of 10 :

SQLDescribeCol:
In:StatementHandle = 0x00000000003BC870, ColumnNumber = 1,
...
Return: SQL_SUCCESS=0
Out:*ColumnName = "ID_EMPLEADO", *NameLengthPtr = 11,
*DataTypePtr = SQL_VARCHAR=12, *ColumnSizePtr = 2000, *DecimalDigits = 0, *NullablePtr = SQL_NULLABLE=1
Clarifying Information
The native Oracle driver (SQORA32.dll) shows the same issue.

 
Error Message
Defect Number
Enhancement Number
Cause
The Oracle server returns a column size of 2000.

Snippet of the snoop log :
Reading 78 bytes (requested 78)

HEX ASCII EBCDIC
00 00 06 00 00 00 00 00 08 01 01 01 80 00 00 02 . . . . . . . . . . . . . . . .
07 D0 00 00 00 00 01 B2 01 02 07 D0 01 0B 01 0B . . . . . . . . . . . . . . . .
0B 49 44 5F 45 4D 50 4C 45 41 44 4F 00 00 00 00 . I D _ E M P L E A D O . . . .
04 01 07 00 00 00 00 00 01 1A 03 00 00 00 00 00 . . . . . . . . . . . . . . . .
00 00 00 00 00 00 00 00 00 00 00 00 00 00 



==> the database returns hex 07 D0 (=2000 decimal) as the column size.
Resolution
This is not a driver issue.

Contact Oracle Support.
Workaround
Notes
Last Modified Date10/18/2016 12:51 PM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.