das kann so nicht funktionieren:

a) der Hexwert wird erkannt, das sieht man in der Spalte Hex

b) hex gibt einen character string zurück

DB2 UDB for AS/400 SQL Reference Seite 165

The HEX function returns a hexadecimal representation of a value.

The argument can be any value.

The result of the function is a character string. If the argument can be null, the result can be null; if the argument is null, the result is the null value.


bei character -> dec Konvertierung gilt:

DB2 UDB for AS/400 SQL Reference Seite 155

Character to Decimal

character-expression

An expression that returns a value that is:
  • A character string representation of a decimal number
  • A character string representation of an integer
  • A character string representation of a floating-point number


Da ist wahrscheinlich etwas Programmieren angesagt. Ich würde einen 3-Zeiler in RPG erstellen, als SQL Function, aber vielleicht gib es noch andere Lösungen ...