Sample Header Ad - 728x90

Snowflake SQL replace function - leverage a dictionary?

0 votes
1 answer
145 views
Looks like translate works for multi translations of single characters (abc -> xyz), but Replace in snowflake will only do 1 replacement. I have a list of JSON objects in a Snowflake SQL database where I need to replace 60 static items into 60 something else items. I was wondering if Replace (or another function) could leverage a dictionary table for this... But I'm guessing the simplest I can do is a For-Loop using a dictionary table. Like "for each X in dictionary table, replace (dict.A->dict.B) in fact table." Or is there a simpler method that doesn't require a for-loop?
Asked by user45867 (1739 rep)
Nov 25, 2024, 10:35 PM
Last activity: Jul 27, 2025, 03:09 AM