BSON_CHECK Function Examples | Teradata Vantage - Examples: Using BSON_CHECK to Validate BSON Data - Advanced SQL Engine - Teradata Database

JSON Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
gzn1554761068186.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1150
lifecycle
previous
Product Category
Teradata Vantageā„¢

Example: BSON_CHECK with Valid BSON Data

The string passed to BSON_CHECK in this query has valid BSON syntax; therefore, the function returns 'OK'.

SELECT BSON_CHECK('160000000268656C6C6F0006000000776F726C640000'xb);

Result:

OK

Example: BSON_CHECK with Invalid BSON Data

The string passed to BSON_CHECK in this query is not valid BSON syntax. The bold portion is an incorrect length for the string that follows. Therefore, the function returns an error message.

SELECT BSON_CHECK('160000000268656C6C6F0005500000776F726C640000'xb);

Result:

INVALID: <error message explaining the syntax error>