我想在redshift中创建一个udf来替换下面的case语句
SELECT CASE
WHEN column1= 'value' then coalesce(replace(column2,',', '')::decimal, 0) /52
WHEN column1= 'value2' then coalesce(replace(column2,',', '')::decimal, 0) /76.0
WHEN column1= 'value3' then coalesce(replace(column2,',', '')::decimal, 0) * 89.3
WHEN column1= 'value4' then coalesce(replace(column2,',', '')::decimal, 0) * 17.85
WHEN column1= 'value5' then coalesce(replace(column2,',', '')::decimal, 0)
ELSE NULL END
1条答案
按热度按时间oalqel3c1#