Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Include Page
_VariablesSummary
_VariablesSummary

Variable Syntax 

The variable format supports setting a default value, data type and a few options as in the following example:

...

PartDefaultDescription
nameRequiredRequired. This is the name that appear in the prompt window. If multiple variables in a script have the same name, the substitution dialog shows only one and the entered value will be applied to all variables with that name
valuenullThe default value for the variable
typenone
(= literal)
The type of variable: String, Boolean, Integer, Float, Long, Double, BigDecimal, Date, Time and Timestamp. In addition DbVisualizer defines: BinaryData and TextData (for CLOB). This is used to determine how the data should be passed between DbVisualizer and the database server. If no type is specified, it is treated as a literal
optionsnone

The options part is used to express certain conditions. Separate these with a whitespace

  • pk
    Indicates that the variable is part of the primary key in the final SQL. Represented with a symbol in the prompt window
  • where
    Defines that the variable is part of the WHERE clause. A symbol indicate this condition in the prompt window
  • noshow
    This option define that the variable should not appear in the prompt window. A value must be set when using this option, unless it is an output variable (see dir below)
  • nobind
    Used in combination with when a type is set and defines that the variable should be replaced as a literal in the SQL rather than being bound as a parameter marker
  • dir=in | out | inout
    The direction for a variable used with the @call command (it is ignored for other uses). A variable assigned the return value for a function must be declared as dir=out, and a variable used for a procedure parameter must use a dir type matching the procedure parameter direction declaration. in is the default

Pre-defined Variables

A few pre-defined DbVisualizer variables can be used anywhere in the SQL. These are replaced with actual values just before the SQL is sent to the DB server. 

...

In an sql script, the name on the result set produced by the next SELECT statement can be set with the @set resultset name command (see KLART: Using Client-Side Commands). This result set name is accessible through the variable

${dbvis-resultset-name}$

Variable Substitution in SQL statements

Note

For variable processing to work in the SQL Commander, make sure the SQL->Enable Parameterized SQL main menu option is checked.

...