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).
Command | Description |
---|---|
@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; |
@export | Use this command to export the result of a query. |
@mail | Use this command to send emails and attach files. |
@import | Import 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. |
@beep | Use 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 restore | Use 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; 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 norows | Use these commands to control what to do when a statement results in a warning or an error. |
@set autocommit on @set autocommit off | Use 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; 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 @rollback | Use these commands to explicitly commit or rollback updates. |
@set serveroutput on @set serveroutput off | Use 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> | 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 |
@stop now | Stop the execution of the script. |