Is it possible to declare variable inside Query Console?
Answered
Is it possible to declare variable, somehow like this and then use it in every queries (so we don't need to put value every time on parameter dialog):
SET/VAR/DECLARE (any style) ${someValue} = 5;
select * from table1 where field1 < ${variable};
select * from table1 where field1 < ${variable} and ...;
Please sign in to leave a comment.
We have user parameters, which can be used in query like
and when you run such query you'll get prompted to enter a value for 'a'. And there is no limit for variable count of course. So no need to declare everything before. If you will use 'a' multiple times in a query - there will be only one request to enter value.
Syntax like
is supported for BigQuery, MS SQL, Sybase, HSQL, Exasol, DB2.
the feature would definitely be helpful for relational databases as well
or maybe a UI-only solution where you can define multiple parameter sets (as sketched here) would already be sufficient