Examples: Using BSON_CHECK to Validate BSON Data

Teradata Vantageā„¢ JSON Data Type

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

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>