I am looking for a way to format money in RisingWave similar to the MySQL FORMAT function. The discussion mentioned using FORMAT
in MySQL and to_char
in PostgreSQL, but it seems RisingWave does not support the PostgreSQL function. How can I achieve this formatting in RisingWave?
Ibrahim
Asked on Feb 13, 2024
to_char
function with the format used in PostgreSQL for formatting money.-- Example query to format money in RisingWave
SELECT CONCAT(SUBSTRING(CAST(2343456 AS VARCHAR), 1, LENGTH(CAST(2343456 AS VARCHAR)) - 2), ',', SUBSTRING(CAST(2343456 AS VARCHAR), LENGTH(CAST(2343456 AS VARCHAR)) - 1, 2), '.00') AS formatted_money;