用逗号替换点

wgx48brx  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(235)

我有下面的代码。小数字符是“.”。我想把它改成“,”。我试图使用替换,但它不工作。你能给我建议一个替代方案吗?

SELECT
,CASE WHEN t1."EID"='10' THEN cast(t1."PAYVal" as decimal(12,2)) ELSE cast(t1."PAYVal"*t2."EXCValue"  as decimal(12,2)) END as plata_LEI
 ,CASE WHEN t1."EID"='2' 
        THEN cast(t1."PAYVal" as decimal(12,2))
      ELSE CASE WHEN t1."EID"='10' THEN cast(t1."PAYVal"/t3."EXCValue"  as decimal(12,2))
           ELSE cast(t1."PAYVal"*t2."EXCValue"/t3."EXCValue" as decimal(12,2))
           END 
    END as plata_EUR

谢谢。

dluptydi

dluptydi1#

您不能使用replace函数,因为您正在将其转换为decimal类型。您需要再次将结果键入文本并使用替换函数,如下所示,

replace((CASE WHEN t1."EID"='10' THEN cast(t1."PAYVal" as decimal(12,2)) ELSE 
cast(t1."PAYVal"*t2."EXCValue"  as decimal(12,2)) END)::text, '.', ',') as plata_LEI

相关问题