Skip to content

DEFINE

Synopsis

1
DEFINE <name> = '<value>';

Where:

1
2
<name>  is the variable name
<value> is the variable value

Description

Defines a variable to be used within SQL statements. Reference the variable with ${variable} syntax.

Valid variable names start with a letter or underscore and are followed by zero or more alphanumeric characters or underscores.

All variable values must be enclosed into single-quotes. Single-quotes are removed during variable substitution. To escape single-quotes, enclose the value with triple-quotes.

There is no type declaration for a value.

Use the SHOW VARIABLES statement to see all variable definitions.

Use the UNDEFINE statement to clear a variable definitions.

Example

1
2
3
4
DEFINE replicas = '3';
DEFINE format = 'JSON';
DEFINE name = 'Tom Sawyer';
DEFINE topicName = '''my_topic'''; -- becomes 'my_topic'

Last update: 2021-03-03