Skip to content
The latest version of DbVisualizer was released 2024-12-04DOWNLOAD HERE ->

Using Client-Side Commands

Only in DbVisualizer Pro

This feature is only available in the DbVisualizer Pro edition.

Introduction

A client-side command is a DbVisualizer specific command prefixed with the at-sign (@). These commands are used in SQL scripts executed either in the SQL Commander in the DbVisualizer UI or in the command-line interface, dbviscmd. Client-side commands are used to control the execution of scripts and run, for example, export and import functionality without needing to interact with the DbVisualizer UI. The @mail command sends emails with support for attachments, useful when using @export and then to mail the result of a query.

Commands reference

You can use these DbVisualizer client-side commands in your SQL scripts. (These commands are processed by DbVisualizer and never sent to the database as-is).

Commands in Scripts

CommandDescription
@beepUse this command to emit a beep sound, e.g. to indicate a significant point in a script.
@call Use this command to execute a function or procedure.
@command ignoreUse this command to ignore executing any following client-side commands. Example:
@echo I will run;
@command ignore;
@echo I will not run;
@command resumeUse this command to resume execution of following client-side commands. Example:
@echo I will run;
@command ignore;
@echo I will not run;
@command resume;
@echo I will also run;
@commitUse this commands to run commit updates.
@continue on errorContinue execution on error.
@continue on norowsContinue execution on norows.
@continue on sqlwarningContinue execution on sqlwarning.
@echo <text>Use this command to write to the Log tab.
@rollbackUse this command to run rollback updates.
@sleep <milliseconds>Use this command to halt processing the specified number of milliseconds.
@stop nowStop the execution of the script.
@stop on errorStop execution on error.
@stop on norowsStop execution on norows.
@stop on sqlwarningStop execution on sqlwarning.

Script Controls

CommandDescription
@delimiter <new_delimiter>Use this command to temporarily change the statement delimiter for a complex statement.
@log <file_name> [spool | close]Use this command to write log messages to a named file. Examples:
@log /tmp/myLog.txt;
@log /tmp/myLog.txt close;
@log /tmp/allLog.txt spool;
1. Logs subsequent commands to the file /tmp/myLog.txt. If we are already logging to another file as the result of a previous @log command that log is closed
2. Stops logging to the file
3. Writes all log messages up to this @log command to the named file
@set autocommit offUse this command set Auto Commit off.
@set autocommit onUse this command set Auto Commit on.
@set dryrun [off]Execute a script or part of a script without actually executing the any commands. As an example below no actual sleep will be done nor will the select be executed.
@set dryrun;
@sleep 2000;
select * from Actor;
@set dryrun off;
The command is primarily used to debug scripts and check that script can run. An exception to this is when used in connection with client-side import commands.
@set maxchars <number>Set Max Chars to limit the number of characters to fetch for text data columns.
@set maxrows <number>Set Max Rows to limit the number of rows fetched for result sets.
@set serveroutput offUse this command to disable output to the DBMS Output tab for databases supporting the DBMS package.
@set serveroutput onUse this command to enable output to the DBMS Output tab for databases supporting the DBMS package.

Metadata Information

CommandDescription
@ddl <params>Use this command to get the DDL for a database object.
@describe <table>Use this command to show column information for a table. The table name may be qualified with a schema and/or database name.

Result set Presentation

CommandDescription
@set resultset name <name>Use this command to name any following result set. When the SQL statement is executed, the tab showing the result set is named using the supplied <name> parameter. Example:
@set resultset name MyActors;
select * from ACTOR;
DbVisualizer will for the example above show the result of the select in a tab named MyActors
@window iconifyUse this command to lower (iconify) the DbVisualizer main window.
@window restoreUse this command to raise (restore) the DbVisualizer main window.

Running Files and Exporting Data

CommandDescription
@cd <directory>Use this command to change directory for any following file related command. execute an external script.
@exportUse this command to export the result of a query.
@importImport table data from CSV, Excel, and TEXT (fixed width column) files
@mailUse this command to send emails and attach files.
@open <file> | <url> [RunOnStop]Use this command to open the specified file in the associated tool. (Not supported in the command-line interface, dbviscmd).
@run <file> [<variables>]Use this command to run the SQL script in the file execute an external script.