Categories:

Semi-structured Data Functions (Extraction)

GET_IGNORE_CASE¶

Extracts a field value from an object; returns NULL if either of the arguments is NULL.

Note

This function is similar to GET but applies case-insensitive matching to field names.

See also:

GET

Syntax¶

GET_IGNORE_CASE( <object> , <field_name> )

GET_IGNORE_CASE( <v> , <field_name> )
Copy

Usage Notes¶

  • This function returns the first exact match it finds. If the function only finds ambiguous (case-insensitive) matches, it returns the value for one of the matches; however, no guarantee can be made on which ambiguous field name is matched first.

  • GET_IGNORE_CASE is a binary function that can be called in the following ways:

    • object is an OBJECT value and field_name is a string value, which can be a constant or an expression.

      This variation of GET_IGNORE_CASE extracts VARIANT value of the field with the provided name from the object value. If the field is not found, NULL is returned. The field name should not be an empty string.

    • v is a VARIANT value and field_name is a string value, which can be a constant or an expression.

      Works similarly to GET_IGNORE_CASE with object, but additionally checks that v contains an object value (and returns NULL if v does not contain an object).

Examples¶

Extract a field value from an object. The function returns the value for the exact match:

SELECT GET_IGNORE_CASE(TO_OBJECT(PARSE_JSON('{"aa":1, "aA":2, "Aa":3, "AA":4}')),'aA') as output;

+--------+
| OUTPUT |
|--------|
| 2      |
+--------+
Copy

Extract a field value from an object. The function cannot find an exact match and so returns one of the ambiguous matches:

SELECT GET_IGNORE_CASE(TO_OBJECT(PARSE_JSON('{"aa":1, "aA":2, "Aa":3}')),'AA') as output;

+--------+
| OUTPUT |
|--------|
| 3      |
+--------+
Copy

For more detailed examples, see Querying Semi-structured Data.