All Forums Analytics
Tnewbee 215 posts Joined 05/10
08 Apr 2014
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?

Qaisar Kiani 337 posts Joined 11/05
10 Apr 2014

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.

Tnewbee 215 posts Joined 05/10
10 Apr 2014

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


case when date <= (


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?

Tnewbee 215 posts Joined 05/10
14 Apr 2014

Any suggestions please?

Adeel Chaudhry 773 posts Joined 04/08
20 Apr 2014

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.

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.