Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification Needed: Does Oracle NoSQL Database Support the LIKE Operator? #139

Open
otaviojava opened this issue Jan 12, 2025 · 1 comment

Comments

@otaviojava
Copy link

It is unclear whether the LIKE operator is supported in the Oracle NoSQL Database. I attempted to execute a query that appeared to follow the correct syntax but encountered an error message suggesting otherwise.

Example Query

SELECT * FROM jakartanosqltck 
WHERE jakartanosqltck.entity = 'Animal' 
  AND jakartanosqltck.content.name LIKE ?

Error Message

The query fails with the following error:

java.lang.IllegalArgumentException: PREPARE: Illegal Argument: Table, index and unquoted field names may contain only alphanumeric values plus the character "_". Error: at (1, 104) mismatched input 'LIKE' expecting {<EOF>, AND, GROUP, IS, LIMIT, OFFSET, OR, ORDER, '[', '*', '.', '<', '<=', '>', '>=', '=', '!=', LT_ANY, LTE_ANY, GT_ANY, GTE_ANY, EQ_ANY, NEQ_ANY, '+', '-', '/', RDIV, '||'}, at line 1:104
rule stack: [parse]

Observations

  • The error suggests that LIKE is not recognized by the query parser.
  • The query follows the expected SQL syntax for LIKE and uses a placeholder (?) for parameter binding.
  • There is no clear indication in the error message whether the issue lies with the LIKE operator itself or some other part of the query.

Request for Clarification

  1. Does Oracle NoSQL Database support the LIKE operator for string pattern matching?
  2. If not, what is the recommended approach for performing pattern matching in queries? For example, should REGEXP_LIKE be used instead?
  3. If LIKE is supported, is there a specific syntax requirement or limitation that needs to be addressed?

Suggested Improvement

If LIKE is unsupported, it would be helpful for the error message to state this, such as: explicitly

The 'LIKE' operator is not supported in Oracle NoSQL Database. Consider using 'REGEXP_LIKE' for pattern matching.

PS: At the documentation I only find the regular expression: https://docs.oracle.com/en/database/other-databases/nosql-database/24.4/nsdev/regular-expression-conditions.html

@dario-vega
Copy link
Member

Use the regex_like function. It provides functionality similar to the LIKE operator in standard SQL, that is, it can be used to check if an input string matches a given pattern.

Because I know you are a Java guy, the syntax of the pattern string is a subset of the one supported by the java Pattern class. Specifically, each character in a regular expression is either a literal character that matches itself, or a meta character, that specifies a "construct" having a special meaning. Only the following constructs are supported: quoted characters, the quotation constructs, the period (.), and the greedy quantifier (*).

Currently, the operators are case sensitive, so please do not use REGEX_LIKE or you will have an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants