MAP_INSERT

functionsupportedCore SQL functions

docs.snowflake.com ↗

Semi-structured and structured data functions

Returns a new MAP consisting of the input MAP with a new key-value pair inserted. That is, an existing key is updated with a new value.

Syntax

supportedpartialnot supportednot scored

MAP_INSERT( <map> , <key> , <value> [ , <updateFlag> ] )

Parameters

NameRequiredDescription
maprequiredThe source map into which the new key-value pair is inserted.
keyrequiredThe new key to insert into the map. Must be different from all existing keys in the map, unless updateFlag is set to TRUE.
valuerequiredThe value associated with the key.
updateFlagoptionalA Boolean flag that, when set to TRUE, specifies the input value is used to update an existing value for a key in the map, rather than inserting a new key-value pair. The default is FALSE.

Returns

Returns a MAP consisting of the input MAP with a new key-value pair inserted or an existing key updated with a new value.

Usage notes