0

When I run a user defined function db2 returns the following error

  SQL0802N  Arithmetic overflow or other arithmetic exception occurred.  
  SQLSTATE=22003

without giving me any indication about which function is the source of that error. Is that any setting on db2 so that I can have something like a stack trace or better information. By just looking at that message I don't know where to start investigating.

2
  • Is it possible to share the code with us? or at least a snippet to reproduce the error. Commented Aug 7, 2013 at 14:32
  • Hi AngocA. I didn't put the code as it is too big and many functions are involved. At the end I found the error (see below) but still I didn't find an easy way to debug it or spot it..I was just lucky. Commented Aug 8, 2013 at 7:28

1 Answer 1

1

Look at the return type of your UDF. If it's something like Decimal(5,2), but the function is trying to return something bigger than that, it would give this error. what does this function do?

You might try looking in the db2dump directory (~sqllib/db2dump) for error logs. Not sure if this is an error that gets logged though.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi. You are right. I found the error and an integer and a decimal with the wrong size were causing the issue. Unfortunately I have to say that I found the bug by luck; the log of db2 doesn't give too much indication.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.