Exit handling routine

Analytics
Enthusiast

Exit handling routine

I have to drop tables looking at commentstring of the table. If the commentstring is not correct, I need to send an email out with the tablename.

Can someone help me with this error handling part?

4 REPLIES
Enthusiast

Re: Exit handling routine

You should be able to do that in UNIX script. Fetch the DDL from dbc tables and export them in some text file and then do the text parsing and take the actions accordingly.

Enthusiast

Re: Exit handling routine

I have done the text parsing using the otranslate. I am inserting all tables which need to be dropped in DRP_tables. If the commenstring is not correct , then I need the insert to throw an error with the tablename and send an email out. My issue is how do we throw an error at a particular record when the commentstring is not correct. I need to send the tablename in error in an email. 

INSERT dbname.Drp_tables

sel  

case when date <= (

SEL

CAST(otranslate ( A.commentstring, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()', '')  AS date format 'yyyy-mm-dd'   ) (char(10))     -- AS DECIMAL(18,0)) 

from dbc.tables A

where databasename = 'XXXX'

--and tablename = 'test'


then tablename else null end as tablename 

from dbc.tables

where databasename = 'XXX'

--and tablename = 'test'

Any ideas on how to handle this?

Enthusiast

Re: Exit handling routine

Any suggestions please?

Teradata Employee

Re: Exit handling routine

Assuming you have all the error-tables in the Drp_Tables table .... you can export it as a text file and using an OS based script .... shell script .... you can send that list as an email.