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
Command | Description |
---|---|
@beep | Use 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 ignore | Use this command to ignore executing any following client-side commands. Example:@echo I will run; |
@command resume | Use this command to resume execution of following client-side commands. Example:@echo I will run; |
@commit | Use this commands to run commit updates. |
@continue on error | Continue execution on error. |
@continue on norows | Continue execution on norows. |
@continue on sqlwarning | Continue execution on sqlwarning. |
@echo <text> | Use this command to write to the Log tab. |
@rollback | Use this command to run rollback updates. |
@sleep <milliseconds> | Use this command to halt processing the specified number of milliseconds. |
@stop now | Stop the execution of the script. |
@stop on error | Stop execution on error. |
@stop on norows | Stop execution on norows. |
@stop on sqlwarning | Stop execution on sqlwarning. |
Script Controls
Command | Description |
---|---|
@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;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 off | Use this command set Auto Commit off. |
@set autocommit on | Use 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;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 off | Use this command to disable output to the DBMS Output tab for databases supporting the DBMS package. |
@set serveroutput on | Use this command to enable output to the DBMS Output tab for databases supporting the DBMS package. |
Metadata Information
Command | Description |
---|---|
@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
Command | Description |
---|---|
@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;DbVisualizer will for the example above show the result of the select in a tab named MyActors |
@window iconify | Use this command to lower (iconify) the DbVisualizer main window. |
@window restore | Use this command to raise (restore) the DbVisualizer main window. |
Running Files and Exporting Data
Command | Description |
---|---|
@cd <directory> | Use this command to change directory for any following file related command. execute an external script. |
@export | Use this command to export the result of a query. |
@import | Import table data from CSV, Excel, and TEXT (fixed width column) files |
@mail | Use 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. |