views:

400

answers:

2

The problem that I am facing is primarily on Exception Handling! When an exception occurs I want to put that data in another log table with the error message. However, in DB2 I am not able to figure out a way to retrieve the corresponding error message for the raised SQLSTATE.

PS: I have a stored procedure for this migration and I am not using any other language to call it.

We could do this through SQLERRM in oracle; probably it should be a small thing, still for some strange reasons I have not been able to find it yet!

Hopefully you would have an idea on this, ;-). I just need a pointer on this.

Thanks,

Harveer Uppal

+1  A: 

DB2 has an SQLERRM function too. All you need to to is capture all of the tokens from the error and feed them into the function for the equivalent message you'd get from the CLP.

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0022027.html

Fred Sobotka
+1  A: 

You should be able to get in the front-end code using DB2Exception.Message property.

Rashmi Pandit