Skip to content
The latest version of DbVisualizer was released 2024-03-11DOWNLOAD 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 attachment support, 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).

CommandDescription
@cd <directory>@run <file> [ <variables> ]Use these command to execute an external script.
@command <ignore|resume>Use this command to ignore any subsequent client side commands (except for the @command of course). Example:
@echo I will run;
@command ignore;
@echo I will not run;
@command resume;
@echo I will also run;

@exportUse this command to export the result of a query.
@mailUse this command to send emails and attach files.
@importImport table data from CSV, Excel, and TEXT (fixed width column) files
@open <file_name>Use this command to open the specified file in the associated tool. (Not supported in the command-line interface, dbviscmd).
@delimiter <new_delimiter>Use this command to temporarily change the statement delimiter for a complex statement.
@call <function_or_proc>Use this command to execute a function or procedure.
@beepUse this command to emit a beep sound, e.g. to indicate a significant point in a script.
@sleep <milliseconds>Use this command to halt processing the specified number of milliseconds.
@echo <text>Use this command to write to the Log tab.
@window iconify@window restoreUse these commands to lower (iconify) or raise (restore) the DbVisualizer main window.
@desc <table>Use this command to show column information for a table. The table name may be qualified with a schema and/or database name.
@ddl <params>Use this command to get the DDL for a database object.
@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
@spool log <file_name>This command is no longer supported anymore. Please use the @log command instead.
@stop on error@stop on sqlwarning@stop on norows@continue on error@continue on sqlwarning@continue on norowsUse these commands to control what to do when a statement results in a warning or an error.
@set autocommit on@set autocommit offUse these commands to control the Auto Commit state.
@set dryrun [off]Offers a way to execute a script or part of a script without actually executing the command fully. 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 actually be run. An exception to this is when used in connection with client-side import commands.
@commit@rollbackUse these commands to explicitly commit or rollback updates.
@set serveroutput on@set serveroutput offUse these commands to enable or disable output to the DBMS Output tab for Oracle databases.
@set maxrows <number>@set maxchars <number>Use these commands to adjust the Max Rows and Max Chars limits for specific queries.
@set resultset name <name><img data-base-url="https://dbvis-software.atlassian.net/wiki" data-image-src="https://dbvis-software.atlassian.net/wiki/download/attachments/51873870/16x1.png?version=1&modificationDate=1704645385000&cacheVersion=1&api=v2" data-linked-resource-container-id="51873870" data-linked-resource-container-version="1" data-linked-resource-content-type="image/png" data-linked-resource-default-alias="16x1.png" data-linked-resource-id="51873872" data-linked-resource-type="attachment" data-linked-resource-version="1" data-media-id="4bc00414-95ac-4df4-9d75-69c4d43b5d93" data-media-type="file" data-unresolved-comment-count="0" loading="lazy" src="images/command-line-icon.png" srcset="https://dbvis-software.atlassian.net/wiki/download/thumbnails/51873870/16x1.png?version=1&modificationDate=1704645385000&cacheVersion=1&api=v2&width=16&height=1 2x, https://dbvis-software.atlassian.net/wiki/download/thumbnails/51873870/16x1.png?version=1&modificationDate=1704645385000&cacheVersion=1&api=v2&width=16&height=1 1x" width="240"></img>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
@stop nowStop the execution of the script.