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 -411 current sqlid cannot be used in a statement that references...
  • DB2
  • December 3, 2024
In this post, you’ll learn about the error message -158 the number of columns specified for the view is not...
  • DB2
  • December 3, 2024
In this post, you’ll learn about the error message -618 operation operation is not allowed on system databases in the...
  • DB2
  • December 3, 2024