From my db2 I have to take a number, example:
1234.56
234
11:55
12323.88
and format in string:
1,234,56
234
11,55
12323.88
I tried:
VARCHAR_FORMAT(VALUE(CASE WHEN X_Type='1' THEN Y_Type ELSE Y_Type*-1 END,0), '9G999D99', 'de_DE') as money
but
"the number of arguments specified for varchar is invalid"
How can I do it? another?
I'm not quite sure what you are trying to code, but maybe this example will help
SELECT
VARCHAR_FORMAT(col, CASE WHEN X_Type='1' THEN Y_Type ELSE Y_Type || 'MI' END, 'de_DE') as money
FROM
TABLE(VALUES
('1','999G999D99', -4324)
, ('2','999G999D99', -4324)
) AS T(X_Type,Y_Type, col)
which returns
MONEY
-----------
-4.324,00
4.324,00-
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.