Oracle database
SELECT DECODE( col1,
1000, 'ITEM-A',
2000, 'ITEM-B',
'ITEM-C')
FROM t1;
* col1 is assumed to be CHAR(4) type
Symfoware Server
SELECT DECODE( CAST(col1 AS INTEGER),
1000, 'ITEM-A',
2000, 'ITEM-B',
'ITEM-C')
FROM t1;
* col1 is assumed to be CHAR(4) type
When the value expression is a string and the search value is a numeric, the string value will be converted to the data type of the comparison target numeric, so that they can be compared.
If the conversion target value expression is a string value, then no search value can be specified with numbers.
Since the data type that can be specified for the conversion target value expression is unknown, use CAST to explicitly convert the conversion target value expression (col1 in the example) to a numeric (INTEGER type in the example).