You can't run a SQL statement from the console prompt. You need to start the SQL shell first:
SAMPLES>do $system.SQL.Shell()
SQL Command Line Shell
----------------------------------------------------
The command prefix is currently set to: <<nothing>>.
Enter <command>, 'q' to quit, '?' for help.
[SQL]SAMPLES>SELECT . . . . your statement
Remove
You can't run a SQL statement from the console prompt.
You need to start the SQL shell first:
SAMPLES>do $system.SQL.Shell() SQL Command Line Shell ---------------------------------------------------- The command prefix is currently set to: <<nothing>>. Enter <command>, 'q' to quit, '?' for help. [SQL]SAMPLES>SELECT . . . . your statement
You should take a look to Using Caché SQL !
Executing SQL
https://docs.intersystems.com/latest/csp/docbook/Doc.View.cls?KEY=GSQL_basics#GSQL_basics_executing
Using the SQL Shell Interface
https://docs.intersystems.com/latest/csp/docbook/Doc.View.cls?KEY=GSQL_shell
Thank you