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

Batch SQL Command Fails #369

Open
pa-emmanuel opened this issue Aug 6, 2020 · 1 comment
Open

Batch SQL Command Fails #369

pa-emmanuel opened this issue Aug 6, 2020 · 1 comment

Comments

@pa-emmanuel
Copy link

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:

@luigidellaquila
Copy link
Member

Hi @pa-emmanuel

For BATCH scripts you have to use session.execute()

Thanks

Luigi

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