17.20 - Catalog Functions - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

Product
ODBC Driver for Teradata
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2022-06-21
dita:mapPath
uqj1639470627591.ditamap
dita:ditavalPath
nkw1500504256726.ditaval

Starting with the 16.20 version of the driver, some catalog functions behave differently in ODBC Driver for Teradata. The functions and the differences in ODBC Driver for Teradata behavior are described in the following sections.

Catalog Function Description
SQLTables Returns the value “TYPE” in the TABLE_TYPE column for user-defined types. The type name is returned in the TABLE_NAME column.
SQLColumns Returns the value SQL_UNKNOWN_TYPE (zero) in the DATA_TYPE for a UDT column. The UDT name is returned in the TYPE_NAME column.
SQLProcedures Returns names of user-defined methods in addition to names of macros, procedures, and user-defined functions.

The value of the PROCEDURE_TYPE column for a user-defined method is SQL_PT_PROCEDURE.

SQLProcedureColumns Returns parameter information for user-defined methods. Also, parameter types might be UDTs and these are returned as for the SQLColumns catalog function (SQL_UNKNOWN_TYPE in DATA_TYPE column and UDT name in TYPE_NAME column).

The output for TD_ANYTYPE parameters results in the value SQL_UNKNOWN_TYPE in the DATA_TYPE column and the string “TD_ANYTYPE” (without quotes) in the TYPE_NAME column.

All Catalog Functions

Regardless of whether operating in an ODBC 2.x or 3.x environment, starting with 16.20, ODBC Driver for Teradata will always return ODBC 2.x column names. In 16.10 and previous versions, ODBC Driver for Teradata returned different names for some columns depending on the environment.

SQLBindParameter

Binding Date, Time, and Timestamp Literals

In 16.10 and prior versions of the driver, when binding any of these types of literals as a parameter, ODBC Driver for Teradata accepted literals that contain extra spaces. Starting with 16.20, ODBC Driver for Teradata only accepts literals that are specified in the exact format specified in the ODBC specification. If you try to bind a literal that does not use the required format, ODBC Driver for Teradata returns the following error:

[Teradata][Support] (40550) Invalid character value for cast specification.

For more information about the required format, see Date, Time, and Timestamp Literals in the ODBC Programmers’ Reference located at https://docs.microsoft.com/sql/odbc/reference/develop-app/date-time-and-timestamp-literals.

As an example, both drivers accept the value {d '1995-01-15'}, but ODBC Driver for Teradata in 16.10 and prior versions accepts the value { d '1995-01-15'} (note the missing space in the first value before 'd', but the inserted space in the second value).

Returning Error Information

Starting with the 16.20 version of the driver, ODBC Driver for Teradata responds to certain errors differently.
  • Starting with 16.20, ODBC Driver for Teradata no longer supports SQL_ARRAY_STATUS_PTR and SQL_DIAG_ROW_NUMBER for parameter sets, so it does not set these properties when an error occurs in a query that contains a parameter set.
  • In 16.10 and previous versions of the driver, if no errors occurred, but some parameter sets were ignored, then ODBC Driver for Teradata set SQL_ATTR_PARAMS_PROCESS_PTR to SQL_ATTR PARAMSET_SIZE minus the number of ignored sets. Starting with 16.20, ODBC Driver for Teradata sets SQL_ATTR_PARAMS_PROCESSED_PTR to the exact value of SQL_ATTR_PARAMSET_SIZE which is consistent with the ODBC specification.

    For more information, see "Error Information" under SQLBindParameter Function in the ODBC Programmers’ Reference: https://docs.microsoft.com/sql/odbc/reference/syntax/sqlbindparameter-function.

Using SQL_DEFAULT_PARAM

When SQL_DEFAULT_PARAM is specified as an indicator via the StrLen_or_IndPtr argument, ODBC Driver for Teradata, in 16.10 and prior versions, ignored it and instead uses the value stored in the buffer. Starting with 16.20, depending upon the environment in which SQL_DEFAULT_PARAM is being used, ODBC Driver for Teradata returns one of the following:
  • If it is specified in a stored procedure call, ODBC Driver for Teradata uses the value NULL to complete the stored procedure call and returns SQL_SUCCESS_WITH_INFO.
  • If it is specified in something other than a stored procedure call, ODBC Driver for Teradata returns SQL_ERROR and does not execute the statement.

This behavior is consistent with the ODBC specification, which states that SQL_DEFAULT_PARAM is valid only when used with a stored procedure call. The database does not support default parameters for stored procedures, so ODBC Driver for Teradata uses NULL as the value for SQL_DEFAULT_PARAM.

For more information, see "SQLBindParameter Function" in the ODBC Programmers’ Reference: https://docs.microsoft.com/sql/odbc/reference/syntax/sqlbindparameter-function.

Query Parameter Binding

When binding query parameters, ODBC Driver for Teradata supports different use cases.

16.10 and Prior Versions 16.20 or Later
When binding JSON or WJSON data to a parameter, ODBC Driver for Teradata returns an error. ODBC Driver for Teradata supports binding JSON and WJSON data to parameters.
ODBC Driver for Teradata does not support binding for SQL_DECIMAL and SQL_NUMERIC data that has a negative scale. ODBC Driver for Teradata supports binding for these types of values, which is consistent with the ODBC specification: https://docs.microsoft.com/sql/odbc/reference/appendixes/decimal-digits .
ODBC Driver for Teradata does not support binding for SQL_DECIMAL and SQL_NUMERIC data that has a precision that is less than 1. ODBC Driver for Teradata supports binding for SQL_DECIMAL and SQL_NUMERIC data that has a precision of 0, in order to support binding for NULL values.
When calling SQLBindParameter, ODBC Driver for Teradata verifies the column sizes of the data and then modifies the column sizes of the input if needed. ODBC Driver for Teradata does not verify column sizes or modify the input from SQLBindParameter. When binding LOB data types, ODBC Driver for Teradata uses the values returned by GetMaxLobBytes() or MaxJSONBytes() as the maximum column size of the LOB data.

Output Parameter Binding

When binding output parameters, a data type conversion is sometimes required. In this case, ODBC Driver for Teradata in 16.10 and prior versions converted the output data to its corresponding SQL type regardless of the data types specified in SQLBindParameter. Starting with 16.20, ODBC Driver for Teradata converts the output data to the specified SQL type, or returns a conversion error if the types are not compatible; this behavior is consistent with the ODBC specification.

For example, given the following procedure:

create procedure CharOutputStoredprocedure(OUT param1 CHAR)
cs1: BEGIN
SET param1 = 'A';
END cs1;

Assume that you bind the output parameters as follows:

SQLBindParameter(
	stmt,
	1,
	SQL_PARAM_OUTPUT,
	SQL_C_CHAR,
	SQL_CHAR,
	1024,
	0,
	&out,
	1024,
	&cbRetParam)

The given SQL type is the same as the SQL type of the original parameter, so the data does not need to be converted. All versions of ODBC Driver for Teradata successfully bind the data and return the value A.

However, if you bind the output parameter as follows, then the data must be converted from CHAR to SQL_INTEGER:

SQLBindParameter(
	stmt,
	1,
	SQL_PARAM_OUTPUT,
	SQL_C_CHAR,
	SQL_INTEGER,
	1024,
	0,
	&out,
	1024,
	&cbRetParam)

The conversion fails because A is not a valid SQL_INTEGER value. ODBC Driver for Teradata in 16.10 and prior versions handled this situation by converting and binding the output data to SQL_CHAR instead. Starting with 16.20, ODBC Driver for Teradata tries to convert the data to SQL_INTEGER and then returns a conversion error with SQL state 22018.

SQLBindParameter and Data Types with Fractional Seconds

When calling SQLBindParameter with a data type that contains fractional seconds, you must set the DecimalDigit to a value up to 6, the maximum the database supports. In 16.10 and prior versions, this can be any number between 0-6 with the same result as if you were to set it to 6, but this is incorrect and no longer supported.

As an example, TIMESTAMP(0) is no longer valid if you are passing in a fractional second because according to the ODBC specification, you have specified zero decimal digits and will receive an error if you try to pass in a fractional second.

You can specify a maximum of up to 6 decimal digits, as this is the limit of the database.

It is acceptable to send less than your specified number of decimal digits.

You can optionally pad out to 9 decimal digits with zeros without issue.

SQLCancel

Starting with 16.20, the response to timing or processing state of the statement has changed in ODBC Driver for Teradata.

The ODBC specification defines the following behavior for SQLCancel in situations where no processing has been done for the statement:
  • In ODBC 3.5, SQLCancel has no effect on the statement. To close a cursor, applications need to call SQLCloseCursor instead of SQLCancel.
  • In ODBC 2.x, SQLCancel has the same effect as SQLFreeStmt with the SQL_CLOSE option. This behavior is defined only for the sake of completeness; applications should call SQLFreeStmt or SQLCloseCursor instead to close cursors.

For more information, see "SQLCancel Function" in the ODBC API Reference: https://msdn.microsoft.com/library/ms714112%28v=vs.85%29.aspx.

16.10 and Prior Versions 16.20 or Later
When executing statements asynchronously, if the execution is completed before SQLCancel is called, ODBC Driver for Teradata returns HY008. ODBC Driver for Teradata returns the result of the statement execution, (SQL_SUCCESS or SQL_ERROR).
If SQLCancel is called before any processing has been done for the statement, ODBC Driver for Teradata closes the statement regardless of whether it is working in ODBC 2.x mode or ODBC 3.x mode.

Closing the statement reflects behavior that is consistent with the ODBC 2.x specification, but not the ODBC 3.x specification.

ODBC Driver for Teradata does not close the statement when it is working in ODBC 3.x mode, and this behavior is consistent with the ODBC 3.x specification.

SQLForeignKeys

In 16.10 and prior versions of ODBC Driver for Teradata, the columns UPDATE_RULE and DELETE_RULE are returned as empty strings. Starting with 16.20, these columns are instead returned as NULL.

SQLGetConnectAttr

The following table lists the results generated by different versions of ODBC Driver for Teradata.

Function 16.10 and Prior Versions 16.20 or Later
SQL_ATTR_ASYNC_ENABLE
Return: SQL_ERROR=-1
Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HY092", *pfNativeError = 0, *pcbErrorMsg = 50, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Invalid Attribute"
Return: SQL_SUCCESS=0
Out: *ValuePtr = SQL_ASYNC_ENABLE_OFF = 0, *StringLengthPtr = 4
SQL_ATTR_DISCONNECT_BEHAVIOR
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> dbc: szSqlState = "HY092", *pfNativeError = 0, *pcbErrorMsg = 50, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC Teradata Driver] Invalid Attribute"
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> dbc: szSqlState = "HY092", *pfNativeError = 10210, *pcbErrorMsg = 75, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC] (10210) Attribute identifier invalid or not supported: 114"
SQL_ATTR_ENLIST_IN_DTC
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> dbc: szSqlState = "HY092", *pfNativeError = 0, *pcbErrorMsg = 50, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC Teradata Driver] Invalid Attribute"
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> dbc: szSqlState = "HY092", *pfNativeError = 10210, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC] (10210) Attribute identifier invalid or not supported: 1207"
SQL_ATTR_PACKET_SIZE
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 44, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC Teradata Driver] Unsupported"
Return: SQL_SUCCESS=0 Out: *ValuePtr = 4096, *StringLengthPtr = 4
SQL_ATTR_TRANSLATE_LIB
Return: SQL_SUCCESS=0 Out: *ValuePtr = "쨀쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊...", *StringLengthPtr = 0
Return: SQL_SUCCESS=0 Out: *ValuePtr = "", *StringLengthPtr = 0

SQLGetDiagField

At this time, ODBC Driver for Teradata in 16.20 or later versions does not support setting the following:
  • SQL_DIAG_CURSOR_ROW_COUNT
  • SQL_DIAG_ROW_COUNT

SQLGetInfo

The following table lists the results generated by ODBC Driver for Teradata in different driver versions.

Function 16.10 and Prior Versions 16.20 or Later
SQL_SQL_CONFORMANCE
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = SQL_SC_SQL92_ENTRY = 1, *StringLengthPtr = 4
SQL_CATALOG_NAME_SEPARATOR
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = 0
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = ".", *StringLengthPtr = 2
SQL_CREATE_TABLE
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000000, *StringLengthPtr = 4
SQL_DROP_TABLE
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000000, *StringLengthPtr = 4
SQL_DROP_VIEW
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000000, *StringLengthPtr = 4
SQL_GETDATA_EXTENSIONS
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x0000000B = SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND, *StringLengthPtr = 4
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x0000000F = SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BLOCK | SQL_GD_BOUND, *StringLengthPtr = 4
SQL_INDEX_KEYWORDS
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000000, *StringLengthPtr = 4
SQL_LOCK_TYPES
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000001 = SQL_LCK_NO_CHANGE, *StringLengthPtr = 4
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000002 = SQL_LCK_EXCLUSIVE, *StringLengthPtr = 4
SQL_MAX_ASYNC_CONCURRENT_STATEMENTS
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0, *StringLengthPtr = 4
SQL_NUMERIC_FUNCTIONS
Return: SQL_SUCCESS=0
Out:*InfoValuePtr = 0x00014D01 = SQL_FN_NUM_ABS | SQL_FN_NUM_EXP | SQL_FN_NUM_LOG | SQL_FN_NUM_MOD | SQL_FN_NUM_SQRT | SQL_FN_NUM_PI, StringLengthPtr = 4
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00194D01 = SQL_FN_NUM_ABS | SQL_FN_NUM_EXP | SQL_FN_NUM_LOG | SQL_FN_NUM_MOD | SQL_FN_NUM_SQRT | SQL_FN_NUM_PI | SQL_FN_NUM_LOG10 | SQL_FN_NUM_POWER, *StringLengthPtr = 4
SQL_ODBC_SAG_CLI_CONFORMANCE
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = SQL_OSCC_COMPLIANT = 1, *StringLengthPtr = 2
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = SQL_OSCC_NOT_COMPLIANT = 0, *StringLengthPtr = 2
SQL_POS_OPERATIONS
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000001 = SQL_POS_POSITION, *StringLengthPtr = 4
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000000, *StringLengthPtr = 4
SQL_QUALIFIER_NAME_SEPARATOR
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = 0
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = ".", *StringLengthPtr = 2
SQL_SCROLL_CONCURRENCY
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000001 = SQL_SCCO_READ_ONLY, *StringLengthPtr = 4
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000003 = SQL_SCCO_READ_ONLY | SQL_SCCO_LOCK, *StringLengthPtr = 4
SQL_SQL92_GRANT
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000010 = SQL_SG_WITH_GRANT_OPTION, *StringLengthPtr = 4
SQL_SQL92_PREDICATES
Return: SQL_ERROR=-1Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00003F07 = SQL_SP_EXISTS | SQL_SP_ISNOTNULL | SQL_SP_ISNULL | SQL_SP_UNIQUE | SQL_SP_LIKE | SQL_SP_IN | SQL_SP_BETWEEN | SQL_SP_COMPARISON | SQL_SP_QUANTIFIED_COMPARISON, *StringLengthPtr = 4
SQL_SQL92_RELATIONAL_JOIN_OPERATORS
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x0000015A = SQL_SRJO_CROSS_JOIN | SQL_SRJO_FULL_OUTER_JOIN | SQL_SRJO_INNER_JOIN | SQL_SRJO_LEFT_OUTER_JOIN | SQL_SRJO_RIGHT_OUTER_JOIN, *StringLengthPtr = 4
SQL_SQL92_STRING_FUNCTIONS
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000006 = SQL_SSF_LOWER | SQL_SSF_UPPER, *StringLengthPtr = 4
SQL_STATIC_SENSITIVITY
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000000, *StringLengthPtr = 4
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = 0x00000003 = SQL_SS_ADDITIONS | SQL_SS_DELETIONS, *StringLengthPtr = 4
SQL_XOPEN_CLI_YEAR
Return: SQL_ERROR=-1
Out: *InfoValuePtr = <unmodified>, *StringLengthPtr = <unmodified>
dbc: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 76, *ColumnNumber = -1, *RowNumber = -1
MessageText = "[Teradata][ODBC Teradata Driver] Driver does not support specified fInfoType"
Return: SQL_SUCCESS=0
Out: *InfoValuePtr = "1995", *StringLengthPtr = 8

SQLGetStmtAttr

The following table lists the results generated by ODBC Driver for Teradata in different driver versions.

Function 16.10 and Prior Versions 16.20 or Later
SQL_ATTR_CURSOR_SCROLLABLE
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> stmt: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 44, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC Teradata Driver] Unsupported"
Return: SQL_SUCCESS=0 Out: *ValuePtr = 0, *StringLengthPtr = 4
SQL_ATTR_CURSOR_SENSITIVITY
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> stmt: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 44, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC Teradata Driver] Unsupported"
Return: SQL_SUCCESS=0 Out: *ValuePtr = 0, *StringLengthPtr = 4
SQL_ATTR_KEYSET_SIZE
Return: SQL_SUCCESS=0 Out: *ValuePtr = 0, *StringLengthPtr = <unmodified>
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> stmt: szSqlState = "HY092", *pfNativeError = 10210, *pcbErrorMsg = 73, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC] (10210) Attribute identifier invalid or not supported: 8"
SQL_ATTR_RETRIEVE_DATA
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> stmt: szSqlState = "HYC00", *pfNativeError = 0, *pcbErrorMsg = 44, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC Teradata Driver] Unsupported"
Return: SQL_SUCCESS=0 Out: *ValuePtr = SQL_RD_ON = 1, *StringLengthPtr = 4
SQL_ATTR_ROW_NUMBER
In 16.10 and prior versions, ODBC Driver for Teradata always returned SQL_ROW_NUMBER_UNKNOWN; starting with 16.20, ODBC Driver for Teradata returns the actual number of the current row in the entire result set.
Return: SQL_SUCCESS=0
Out: *ValuePtr = 0, *StringLengthPtr = <unmodified>
Return: SQL_SUCCESS=0
Out: *ValuePtr = 1, *StringLengthPtr = 4
SQL_ATTR_SIMULATE_CURSOR
Return: SQL_SUCCESS=0 Out: *ValuePtr = SQL_SC_NON_UNIQUE = 0, *StringLengthPtr = <unmodified>
Return: SQL_ERROR=-1 Out: *ValuePtr = <unmodified>, *StringLengthPtr = <unmodified> stmt: szSqlState = "HY092", *pfNativeError = 10210, *pcbErrorMsg = 74, *ColumnNumber = -1, *RowNumber = -1 MessageText = "[Teradata][ODBC] (10210) Attribute identifier invalid or not supported: 10"

SQLGetTypeInfo

In 16.10 and prior verisons of ODBC Driver for Teradata, TDODBC_DATA_TYPE moves to indexv21, and USER_DATA_TYPE is inserted at index 20.

Starting with 16.20, ODBC Driver for Teradata returns an additional custom column "USER_DATA_TYPE" at index 20.

1, TYPE_NAME, 9, SQL_VARCHAR=12, 128, 0, SQL_NO_NULLS=0
2, DATA_TYPE, 9, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
3, COLUMN_SIZE, 11, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
4, LITERAL_PREFIX, 14, SQL_VARCHAR=12, 32, 0, SQL_NULLABLE=1
5, LITERAL_SUFFIX, 14, SQL_VARCHAR=12, 32, 0, SQL_NULLABLE=1
6, CREATE_PARAMS, 13, SQL_VARCHAR=12, 32, 0, SQL_NULLABLE=1
7, NULLABLE, 8, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
8, CASE_SENSITIVE, 14, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
9, SEARCHABLE, 10, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
10, UNSIGNED_ATTRIBUTE, 18, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
11, FIXED_PREC_SCALE, 16, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
12, AUTO_UNIQUE_VALUE, 17, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
13, LOCAL_TYPE_NAME, 15, SQL_VARCHAR=12, 128, 0, SQL_NULLABLE=1
14, MINIMUM_SCALE, 13, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
15, MAXIMUM_SCALE, 13, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
16, SQL_DATA_TYPE, 13, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
17, SQL_DATETIME_SUB, 16, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
18, NUM_PREC_RADIX, 14, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
19, INTERVAL_PRECISION, 18, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
20, USER_DATA_TYPE, 14, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
21, TDODBC_DATA_TYPE, 16, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0

SQLProcedureColumns

In 16.10 and prior versions of ODBC Driver for Teradata:
  • The driver uses SQL_VARCHAR for string columns.
  • TDODBC_DATA_TYPE moves from index 20 to 22, with "IS RESULT SET COLUMN" and USER_DATA_TYPE inserted at index 20 and 21.

Starting with 16.20, ODBC Driver for Teradata uses SQL_WVARCHAR for string columns and returns two additional custom columns, at index 20 and 21.

1, PROCEDURE_CAT, 13, SQL_VARCHAR=12, 1024, 0, SQL_NULLABLE=1
2, PROCEDURE_SCHEM, 15, SQL_VARCHAR=12, 30, 0, SQL_NULLABLE=1
3, PROCEDURE_NAME, 14, SQL_VARCHAR=12, 30, 0, SQL_NO_NULLS=0
4, COLUMN_NAME, 11, SQL_VARCHAR=12, 30, 0, SQL_NO_NULLS=0
5, COLUMN_TYPE, 11, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
6, DATA_TYPE, 9, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
7, TYPE_NAME, 9, SQL_VARCHAR=12, 128, 0, SQL_NO_NULLS=0
8, COLUMN_SIZE, 11, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
9, BUFFER_LENGTH, 13, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
10, DECIMAL_DIGITS, 14, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
11, NUM_PREC_RADIX, 14, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
12, NULLABLE, 8, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
13, REMARKS, 7, SQL_VARCHAR=12, 254, 0, SQL_NULLABLE=1
14, COLUMN_DEF, 10, SQL_VARCHAR=12, 4000, 0, SQL_NULLABLE=1
15, SQL_DATA_TYPE, 13, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
16, SQL_DATETIME_SUB, 16, SQL_SMALLINT=5, 5, 0, SQL_NULLABLE=1
17, CHAR_OCTET_LENGTH, 17, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
18, ORDINAL_POSITION, 16, SQL_INTEGER=4, 10, 0, SQL_NO_NULLS=0
19, IS_NULLABLE, 11, SQL_VARCHAR=12, 254, 0, SQL_NULLABLE=1
20, IS RESULT SET COLUMN, 20, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
21, USER_DATA_TYPE, 14, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0
22, TDODBC_DATA_TYPE, 16, SQL_SMALLINT=5, 5, 0, SQL_NO_NULLS=0

SQLTables

When using pattern matching with a wildcard character (%), the default catalog metadata is null. Starting with 16.20, ODBC Driver for Teradata returns SQL_INTEGER as the SQL Type for some columns.

For example, for the following call:

SQLTables(<empty string>, %, <empty string>, <null pointer>)

Returns:

icol, szColName, *pcbColName, *pfSqlType, *pcbColDef, *pibScale, *pfNullable
1, TABLE_CAT, 9, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
2, TABLE_SCHEM, 11, SQL_VARCHAR=12, 128, 0, SQL_NULLABLE=1
3, TABLE_NAME, 10, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
4, TABLE_TYPE, 10, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1
5, REMARKS, 7, SQL_INTEGER=4, 10, 0, SQL_NULLABLE=1