Examples: Using the USING QUOTES Clause

Teradata Vantageā„¢ JSON Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1150-162K

Example: USING QUOTES ('Y')

In this example, JSON_KEYS is invoked with the USING QUOTES ('Y') clause; therefore, the key names returned in the result are enclosed in double quotation marks.

SELECT * FROM JSON_KEYS 
(ON (SELECT NEW JSON('{ "x":{"a":{"b":3}}  , "y" : "b"}')) USING QUOTES('Y')) 
AS json_data;

Result:

KEYS
----
"x"
"x"."a"
"x"."a"."b"
"y"

Example: USING QUOTES ('N')

In this example, JSON_KEYS is invoked with the USING QUOTES ('N') clause; therefore, the key names returned in the result are not enclosed in double quotation marks.

SELECT * FROM JSON_KEYS 
(ON (SELECT NEW JSON('{ "x":{"a":{"b":3}}  , "y" : "b"}')) USING QUOTES('N')) 
AS json_data;

Result:

KEYS
----
x
x.a
x.a.b
y

Example: USING QUOTES Is Not Specified

In this example, JSON_KEYS is invoked without specifying the USING QUOTES clause. The default behavior is to return the key names enclosed in double quotation marks.

SELECT * FROM JSON_KEYS 
(ON (SELECT NEW JSON('{ "x":{"a":{"b":3}}  , "y" : "b"}'))) 
AS json_data;

Result:

KEYS
----
"x"
"x"."a"
"x"."a"."b"
"y"