15.10 - BSON_CHECK - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty

Purpose

The BSON_CHECK function checks a string for valid BSON syntax and provides an informative error message about the cause of the syntax failure if the string is invalid.

Syntax



Syntax Elements

TD_SYSFNLIB
The name of the database where the function is located.
BSON_data
A string to be tested for compliance to BSON syntax.
BYTE, VARBYTE, and BLOB are the allowed input types.
A maximum of 16776192 bytes may be passed in for validation.
STRICT
The data is validated according to the BSON specification located at http://bsonspec.org/ and the MongoDB restrictions specified in http://docs.mongodb.org/meta-driver/latest/legacy/bson/.
The character string 'STRICT' is not case sensitive. For example, you can also specify 'strict'.
LAX
The data is validated according to the BSON specification located at http://bsonspec.org/. This is the default behavior if you do not specify 'STRICT' or 'LAX'.
The character string 'LAX' is not case sensitive. For example, you can also specify 'lax'.

Return Value

  • 'OK', if the string is valid BSON syntax.
  • 'INVALID: error message', if the string is not valid BSON syntax. The error message provides an informative message about the cause of the syntax failure.
  • A Teradata NULL, if the input string is NULL.

Usage Notes

This function only tests data for compliance with BSON syntax. It does not create a JSON instance.

You can use this function to validate JSON data that is in BSON format before loading it. This can save time when loading a large amount of BSON data by preventing the rollback of an entire transaction in the event of a BSON syntax error. The function also provides the necessary information to fix any syntax errors that may be present before you load the data.