How to Retrive Error message associated with SQLSTATE

Database

How to Retrive Error message associated with SQLSTATE

Hi

This problem is related to procedures in Teradata.

Whenever an exception is raised at runtime in a procedure

It gives a particular code in SQLSTATE ,a System variable for error code.

I want to insert in error log table (sqlstate, message).

Here the message associated with that particular SQLSTATE.

How I can do it ?

In oracle we can do this with

Sqlcode and Sqlerrm( for message)

But I need for Teradata.

Thanks & Regards
Harvinder Singh
1 REPLY
ac
N/A

Re: How to Retrive Error message associated with SQLSTATE

Hi Harvinder

I'm not aware of an automated way to do this with Teradata. You might need to build a mapping table of SQLSTATE to RDBMS error and then join that to the dbc.errormsgs table to get the message? Although errormsgs is generic and wouldn't give you specific DB or tables names for a given instance of an error. The Stored Procedure manual has a table of SQLSTATE/RDBMS error mappings in it.

Cheers,

Andy