
If the statement is valid and you have appropriate privileges, the SQL Shell echoes your SQL statement, assigning a sequential number to it. For further details, refer to the “ Users, Roles, and Privileges” chapter of this manual. The SQL Shell performs SQL privilege checking you must have the appropriate privileges to access or modify a table, field, etc. If not, it displays the appropriate SQLCODE. To prepare an SQL statement, the SQL Shell first validates the statement, including confirming that the specified tables exist in the current namespace and the specified fields exist in the table.

Typing ? at the multiline prompt lists these multiline commands. Issuing a command does not increment the line number of the next multiline prompt.
ACCESSING SQL PROMPT FROM AZURE DATA STUDIO CODE
Q or QUIT to delete all SQL code entered thus far and return to single line mode. G or GO to prepare and execute the SQL code and return to single line mode. C n or CLEAR n (where n is a line number integer) to delete a specific line of SQL code. C or CLEAR to delete all SQL code entered thus far. Multiline mode provides the following commands, which you type at the multiline prompt and then press Enter: L or LIST to list all SQL code entered thus far. For other SQL statements, the SQLCODE and row count values are displayed on the terminal screen. For a query, the result set is displayed on the terminal screen. By default, this both prepares and executes the SQL code. (A blank line does not increment the line number.) To conclude a multiline SQL statement, type GO and press Enter.

You can type multiple lines of SQL code, each new line prompt indicating the line number. Multiline mode: at the prompt press Enter. By default, this both prepares and executes the SQL code (this is known as Immediate execute mode). Single line mode: at the prompt type a line of SQL code. By default, the SQL Shell prompt appears as follows nsp>, where nsp is the name of the current namespace.Īt this prompt you can use either of the following Shell modes: Where is a literal indicating that you are in the SQL Shell, termprompt is the configured terminal prompt, and > is a literal indicating the SQL command line. The following examples show how this method is used from the Terminal prompt: You can execute a single line of SQL code from the Terminal command line without invoking the SQL Shell by using the $() method. Setting SQL Shell configuration parameters.ĭisplaying the statement text, cached query name, and literal arguments.ĭisplaying query plans using EXPLAIN or Show Plan.Įxecuting Transact-SQL statements (Sybase or MSSQL) from the SQL Shell.Ĭopy link to this section Other Ways of Executing SQL Storing and recalling SQL statements by number or by assigned name.

Using input parameters to interactively supply values to an SQL statement at execution time.Įxecuting ObjectScript commands from within the SQL Shell.īrowsing the schemas, tables and views in the current namespaceĮxecuting an SQL stored procedure using the SQL CALL statement.Įxecuting an SQL script file using the Shell’s RUN command. Invoking the SQL Shell inputting and executing SQL from the Terminal as a single line or a multiline SQL statement. Other ways of executing SQL from the Terminal prompt, from Management Portal, or from a program. The following topics are documented in this chapter: Unless otherwise indicated, SQL Shell commands and SQL code are not case-sensitive. It accesses resources and performs operations within the current namespace. The SQL Shell uses Dynamic SQL, which means that queries are prepared and executed at runtime. This interactive SQL Shell allows you to execute SQL statements dynamically. One way to test SQL statements is to execute them from the InterSystems IRIS® data platform Terminal using the SQL Shell.
