Skip to end of metadata
Go to start of metadata

In the SQL Commander, you can execute one or multiple statements. You can also control if the execution should stop or continue when the execution of a statement results in a warning or error.

Execute Multiple Statements

Use the SQL->Execute main menu operation to execute the SQL in the SQL Commander editor. The SQL Commander executes the statements one by one and indicates the progress in the log area. The currently selected Database Connection is used for all statements. The SQL Commander does not support executing SQLs for multiple database connections in one batch. 

DbVisualizer uses the delimiters specified in the Tool Properties dialog, in the SQL Commander/Statement Delimiters category under the General tab, to separate one statement from the next.

The result of the execution is displayed in the results area based on the type of results result(s) that are returned. If there are several results and an error occurred in one of them, the Log tab is automatically displayed to indicate the error. 

If you select a statement in the SQL editor and choose SQL->Execute main menu option, only the selected statement is executed. This is a useful feature when you have several SQL statements in the SQL editor and you just want to execute one or a few of the statements.

Comments in the SQL editor are sent to the database when you use SQL->Execute, unless you have enabled Strip Comments when Executing in the SQL Commander menu.

Execute Only the Current Statement

Only in DbVisualizer Pro

This feature is only available in the DbVisualizer Pro edition.

The SQL->Execute Current operation is useful when you have a script with several SQL statements. It lets you execute the statement at the cursor position without first having to select the SQL statement. The default key binding for execute current is Ctrl-PERIOD (Ctrl-.).

Execute Current determines the actual statement by parsing the editor buffer using the standard statement delimiters.The current statement is the statement containing the caret or that ends on the line with the caret. This means that the caret may be after the statement delimiter as long as there is no other statement on the same line.

If you are unsure what the boundaries are for the current statement then use Edit->Select Current Statement. This will highlight the current statement without executing it.

Control Execution after a Warning or an Error

You can control whether subsequent statements should be executed when a statement results in an error, a warning or returns or affects no rows.

Open Tools->Tool Properties and select the SQL Commander category under the General tab. There you find Stop on Error, Stop on SQL Warning and Stop on No Rows check boxes for enabling these features in all SQL Commander tabs.

Alternatively, you can use DbVisualizer client side commands to enable or disable these features in a script.

@stop on error;
@stop on sqlwarning;
@stop on norows;

@continue on error;
@continue on sqlwarning;
@continue on norows;
  • No labels