Emanuela Liaci
Emanuela Liaci

Reputation: 185

Variable declaration in Exasol

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.

Upvotes: 2

Views: 2161

Answers (3)

Amun_Re
Amun_Re

Reputation: 186

Here you go:

define stuff='hello';

SELECT * FROM table WHERE column=':stuff';

Upvotes: 1

Peggy
Peggy

Reputation: 15

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/

Upvotes: 1

wildraid
wildraid

Reputation: 146

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.

Upvotes: 0

Related Questions