Search code examples
orientdborientdb2.2

OrientDB studio/console - How do I run batch script/javascript queries


I want to run multi line queries/batch query, but it is not working both in studio and console in orientdb 2.2 community edition. is there something I need to do, I am sure something is missing at my end.

script sql
    LET $a = 
    MATCH 
    {class:Member, as:m};

select expand($a.m);
end;

Solution

  • In v 2.2 the newline character is considered as a statement separator, so you have to write queries on a single line:

    script sql
    LET $a = MATCH {class:Member, as:m} RETURN m;
    select expand($a.m);
    end;
    

    In v 3.0 it's not needed anymore, the only statement separator is the semicolon, so you can write multi-line queries in scripts.

    To run a script in Studio, you have to select the BATCH mode in the menu at the bottom right corner of the query editor (near the "explain" button)