In a path expression, array indexing is zero-based (0, 1, 2.), as in the JavaScript convention for arrays. If a wildcard is used for the field then the step returns the values of all fields, in no special order.Īn array step is a left bracket ( ). An object step returns the value of the field that is specified. A nonempty field name must start with an uppercase or lowercase letter A to Z and contain only such letters or decimal digits (0-9), or else it must be enclosed in double quotation marks ( "). A field name can be empty, in which case it must be written as "". ), sometimes read as "dot", followed by an object field name (object property name) or an asterisk ( *) wildcard, which stands for (the values of) all fields. The last step of a simple path expression can be a single, optional function step.Īn object step is a period (. Each step can be an object step or an array step, depending on whether the context item represents a JSON object or a JSON array. The dollar sign is followed by zero or more path steps. That data is the result of evaluating a SQL expression that is passed as argument to the SQL/JSON function. (This is not allowed, for example: = 2).c.)Īn absolute simple path expression begins with a dollar sign ( $), which represents the path-expression context item, that is, the JSON data to be matched. No steps can follow the filter expression. The optional filter expression can be present only when the path expression is used in SQL condition json_exists. Matching of data against SQL/JSON path expressions is case-sensitive.Ī SQL/JSON basic path expression (also called just a path expression here) is an absolute simple path expression, followed by an optional filter expression. However, this basic syntax is extended by relaxing the matching of arrays and non-arrays against non-array and array patterns, respectively - see SQL/JSON Path Expression Syntax Relaxation. If matching each step succeeds then matching of the path expression succeeds. If matching any step fails then no attempt is made to match the subsequent steps, and matching of the path expression fails. In all cases, path-expression matching attempts to match each step of the path expression, in turn. (No user-visible sequence is manifested.) You can think of this behavior as returning a sequence of values, as in XQuery, or you can think of it as returning multiple values. SQL/JSON function json_query returns all of the matching values, that is, it can return multiple values. If no value matches the path expression then json_value returns SQL NULL. If a single value matches, then SQL/JSON function json_value returns that value if it is scalar and raises an error if it is non-scalar. SQL/JSON condition json_exists returns true if at least one value matches, and false if no value matches. A path expression selects zero or more JSON values that match, or satisfy, it. SQL/JSON path expressions have a simple syntax. Similar to the way that SQL/XML allows SQL access to XML data using XQuery expressions, Oracle Database provides SQL access to JSON data using SQL/JSON path expressions. When JSON data is stored in the database you can query it using path expressions that are somewhat analogous to XQuery or XPath expressions for XML data. JSON is a notation for JavaScript values. Oracle Database provides SQL access to JSON data using SQL/JSON path expressions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |