Skip to main content

STRIP_NULL_VALUE

Introduced or updated: v1.2.762

Converts a JSON null value to a SQL NULL value. All other variant values are passed unchanged.

Syntax

STRIP_NULL_VALUE(<variant_expr>)

Arguments

An expression of type VARIANT.

Return Type

  • If the expression is a JSON null value, the function returns a SQL NULL.
  • If the expression is not a JSON null value, the function returns the input value.

Examples

SELECT STRIP_NULL_VALUE(PARSE_JSON('null')) AS value;

╭───────╮
value
├───────┤
NULL
╰───────╯

SELECT STRIP_NULL_VALUE(PARSE_JSON('{"name": "Alice", "age": 30, "city": null}')) AS value;

╭───────────────────────────────────────╮
value
├───────────────────────────────────────┤
│ {"age":30,"city":null,"name":"Alice"} │
╰───────────────────────────────────────╯
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today