orientechnologies / orientechnologies/orientdb-docs

Batch SQL Command Fails

Open
#369 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
59
Forks
165
PR merge metrics
No merged PRs in 30d

Description

I wanted to insert a record into Another_Class if Check_Class exists and I wrote the following batch SQL command but it failed with the error below. I have used the next line character (\n) around the IF as required in doc 3.0.x but it is still not working.

session.command("LET $a = (SELECT from V WHERE @class = 'Check_Class' limit 1); \n if($a.size() = 0) { \n INSERT INTO CLASS Another_Class SET name = 'test'; \n }");

xxxxxxxxxxx ERROR xxxxxxxxxxxxxxxxxxxxxx
Exception in thread "main" com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:
LET $a = (SELECT from V WHERE @class = 'Check_Class' limit 1);
if($a.size() = 0) {
^
INSERT INTO CLASS Another_Class SET name = 'test';
} 
Encountered " "if "" at line 2, column 2.
Was expecting:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the batch SQL example in the referenced 3.0.x documentation with the command and parser error shown here. Reproduce the command if the relevant OrientDB setup is available, then verify whether the documentation or the reported syntax is incorrect. Done means the documented example matches supported behavior or clearly explains the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.