I am trying to create a function that adds 1 to the value in a
hexadecimalcolumn. This function I want to use inside an SQL PL procedure.
I have a table with a column with char(16) for bit data. A 'select hex(col1)
from tab1' may return x'FFF59E344C59684CA17BB105677343BE'. I have tried to
create a function that takes the hexadecimal value (the in parameter is also
char(16) for bit data) and adds 1 to the input value. I have managed to add
1 to the value of the input parameter and get this:
x'FFF59E344C59684CA17BB105677343BF'. And this seems to work for any
hexadecimal value I try. But how do I convert this text string back to a
hexdecimal value so that I am able to update the column i db2? If I return
it as CHAR(35) - as a character string and try to update I get this value in
the column: x'78274646463539453334344335393638' ....
I try to do this from Command Center or a Command Window: update tab1 set
col1 = x'FFF59E344C59684CA17BB105677343BF' then it works. But why will it
not work inside a SQL PL procedure when I do: update tab1 set col1 = var1
(where var1 is CHAR(35) and contains x'FFF59E344C59684CA17BB105677343BF').
Regards
Odd Bjørn Andersen
ErgoGroup AS
Postboks 4364 Nydalen, N-0402 Oslo, Norway
Telefon +4723 14 50 00, Telefaks +4723 14 50 01
Mobilnr +47970 84597
www.ergogroup.no