DB2 Error Code – -138 the second or third argument of the substr function is out of range

In this post, you’ll learn about the error message -138 the second or third argument of the substr function is out of range in the IBM DB2 database , the reason why it occurs along with the solution to fix it

IBM DB2 Error Message

-138 the second or third argument of the substr function is out of range

Reason for the Error

One of the following conditions exists:� *�� The second argument of the SUBSTR function is less than 1 or greater���� than M.� *�� The third argument of the SUBSTR function is an integer constant 0 or���� an expression whose value is less than 0 or greater than M-N+1.� M is the length of the first argument, if it is of fixed-length, or M is the maximum length of the first argument, if it is of varying-length.� N is the value of the second argument.

Solution

Ensure that the second and third arguments of the SUBSTR function have legal values according the above rules.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the error message -952 processing was interrupted by a cancel request from a client...
  • DB2
  • November 21, 2022
In this post, you’ll learn about the error message -927 the langrage interface was called when the connecting environment was...
  • DB2
  • November 21, 2022
In this post, you’ll learn about the error message -926 rollback not valid in ims/vs or cics environment in the...
  • DB2
  • November 21, 2022