1

I am new with Exasol and haven't found out how one can declare a variable as in SQL. In SQL I would write:

DECLARE @variable_name datatype [ = initial_value ]

And in Exasol? Many thanks in advance for the help.

Emanuela Liaci
  • 165
  • 1
  • 12

3 Answers3

1

In Exasol a stored procedure is described as a 'SCRIPT'. Script variables are typed dynamically. You can use script variables in the following way: local msg='Hello' https://docs.exasol.com/content/database_concepts/scripting/general_script_language.htm

In ExaPlus (user interface) you could use "define". Example define msg='Hello'; https://optimumretrieval.wordpress.com/2016/12/15/using-variables-in-exaplus/

Peggy
  • 15
  • 6
0

There is such feature in ExaPlus client. It's described in User Manual.

But you have to keep a few things in mind:

  • ExaPlus GUI is no longer available starting from Exasol 6.1;
  • It is purely client-side feature. There are no variables in other clients or DBMS itself;

But you may still build your query normally with placeholders pointing to variables using any programming language.

wildraid
  • 126
  • 4
0

Here you go:

define stuff='hello';

SELECT * FROM table WHERE column=':stuff';
Amun_Re
  • 136
  • 6