Specify a Custom Error Code for Teradata

 

Availability: Hyper-Q 3.39.0 and later.

 

The default_teradata_error_code hint lets you specify a Teradata error code that you choose to be returned by Hyper-Q. Typically, Hyper-Q returns the error code 3706 for most errors. In the example below the first SELECT statement uses default_teradata_error_code to specify a value of 9999, which is then returned in the resulting error message. The second SELECT statement does not specify a custom error code value and returns 3706.

SELECT

-- @dtm_default_teradata_error_code = 9999

1/0;

*** Failure 9999 DTM3103: Failed to run query on the underlying database: Error Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Divide by zero error encountered. SQLSTATE IS: 22012, Backend Error Code: 8134, SQL State: 22012 (odbc_beta:453)

Statement# 1, Info =0

SELECT 1/0;

*** Failure 3706 DTM3103: Failed to run query on the underlying database: Error Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Divide by zero error encountered. SQLSTATE IS: 22012, Backend Error Code: 8134, SQL State: 22012 (odbc_beta:453)

Statement# 1, Info =0

The syntax for default_teradata_error_code is: 

default_teradata_error_code error_code  

where: 

Parameter Description
default_teradata_error_code

Configuration option that lets you specify that a specific Teradata error code to be returned by Hyper-Q.

Typically, Hyper-Q returns 3706 for most errors it reports from Teradata. This option lets you configure a custom value.

error_code The value of the error you wish to assign. Error codes can be a numeric value ranging from 0-65535.

 

Examples

Specify a Custom Error Code for Teradata Using Embedded Comments

This example configures Hyper-Q to return an error code of 9999 as the default error code value. When specified in this manner, the hint applies only to the statement in the request where it is embedded.

-- @dtm_default_teradata_error_code = 9999

Specify a Custom Error Code for the Duration of a Session

Using the for session hint, you can specify that default_teradata_error_code be used for the duration of a session, as opposed to for a single query.

-- @dtm_default_teradata_error_code = 9999 for session

Specify a Custom Error Code Using the Hyper-Q Configuration File

You can configure a custom error code in the Hyper-Q configuration file. Doing so applies the configuration you specify globally for all queries using the Hyper-Q gateway. Add the configuration option to the [gateway] section of the /opt/datometry/config/dtm.ini file.

Note: Hyper-Q can use multiple gateways. The custom error code only applies to the gateways you configure with this hint.

"gateway".default_teradata_error_code = 9999

Have more questions? Submit a request

0 Comments

Article is closed for comments.