Skip to content

Commit aac06dd

Browse files
committed
Clarify handling of empty arguments in xpath function contains
1 parent 7eda702 commit aac06dd

File tree

1 file changed

+22
-0
lines changed
  • content/en/docs/refguide/modeling/xpath/xpath-constraints/xpath-constraint-functions

1 file changed

+22
-0
lines changed

content/en/docs/refguide/modeling/xpath/xpath-constraints/xpath-constraint-functions/xpath-contains.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ The `contains()` function tests whether a string attribute contains a specific s
1313
String comparisons in XPath constraints are generally case-insensitive, but this can depend on the collation setting for some databases. See [Case-Sensitive Database Behavior](/refguide/case-sensitive-database-behavior/) for more information.
1414
{{% /alert %}}
1515

16+
## Syntax
17+
18+
The syntax is as follows:
19+
20+
```
21+
contains ( attribute, string_expression )
22+
```
23+
24+
### attribute
25+
26+
`attribute` specifies the attribute to test in. Attribute must be of the **String** type.
27+
28+
### expression
29+
30+
`string_expression` specifies the value to test for being contained in the attribute. It can be a string literal or an expression that returns a string.
31+
32+
{{% alert color="info" %}}
33+
In the case the `attribute` is empty or `NULL`, the function will always return `false`, independent of the value of `string_esxpression`.
34+
35+
In the case the `string_expression` is empty, it is treated as an empty string. The function is then equivalent to ```attribute != ''```.
36+
{{% /alert %}}
37+
1638
## Example
1739

1840
This query returns all the customers from which the name contains the string `an`:

0 commit comments

Comments
 (0)