Had to solve the following in SQL recently, thus nice Mini-Golf topic.

Task is to write a UDF that accepts either an interger value or packed integer. A packed integer is converted from an integer such that the plus/minus-sign is embedded in the last character of the converted number. the translation table is as follows:
Code:

SysVal ActVal PosNeg
A 1 1
B 2 1
C 3 1
D 4 1
E 5 1
F 6 1
G 7 1
H 8 1
I 9 1
J 1 -1
K 2 -1
L 3 -1
M 4 -1
N 5 -1
O 6 -1
P 7 -1
Q 8 -1
R 9 -1
{ 0 1
} 0 -1



Therefore integer "1" would be written as packed integer "A" and integer "-1" would be written as packed integer "J". Note that you can write "0" as both "{" and "}", either one is correct

Furthermore, integer "1234" would translate to "123D" and integer "-1234" would then be "123M".
_________________________
There are two types of vessels, submarines and targets.