Contents Index Canceling an Interactive SQL command Looking up tables, columns, and procedures

ASA Getting Started
  Using Interactive SQL
    Working with SQL statements in Interactive SQL

Executing multiple statements


The Interactive SQL environment allows multiple statements to be entered at the same time. This can be done by ending each statement with a command delimiter. The command delimiter is a configurable option in Interactive SQL that you can change using the COMMAND_DELIMITER option. By default, it is a semicolon (;).

For more information, see COMMAND_DELIMITER option [ISQL].

To enter multiple statements in SQL Statements pane

  1. Enter the following three commands into the SQL Statements pane.

    UPDATE employee
    SET dept_id = 400,
        manager_id = 1576
    WHERE emp_id = 467;
    
    UPDATE employee
    SET dept_id = 400,
        manager_id = 1576
    WHERE emp_id = 195;
    
    SELECT *
    FROM employee
    WHERE emp_id IN ( 195, 467 );
  2. On the toolbar, click the Execute SQL Statement button. All three statements are executed. After execution, the commands remain in the SQL Statements pane.

  3. Roll back your changes by typing ROLLBACK in the SQL Statements pane and executing the statement.

Using go as an alternative 

An alternative to using the semicolon is to enter go on a line by itself, at the beginning of the line.

UPDATE employee
SET dept_id = 400,
    manager_id = 1576
WHERE emp_id = 467
go

UPDATE employee
SET dept_id = 400,
    manager_id = 1576
WHERE emp_id = 195
go

SELECT *
FROM employee
WHERE emp_id IN ( 195, 467 )
go
Tip 
You can press F9 to execute only the selected text in the SQL Statements pane.

Contents Index Canceling an Interactive SQL command Looking up tables, columns, and procedures