[英]Format number in string with db2, error "the number of arguments specified for varchar is invalid"
From my db2 I have to take a number, example:从我的 db2 我必须取一个数字,例如:
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-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.