sqlexasolution

Executing multiple statements in Exasol as we do in SQL server procedure


When we have multiple select statements we can put them in one procedure and execute it one go. However in Exasol so we have any functionality where we can write in Script/Function where we can execute the multiple statements.

For eg : Select ...;
select ....;
select ...;
In SQL server:
Create procedure sample
Begin
Select ...;
select ....;
select ...;
End

Can we do some what same like in procedure.


Solution

  • If you have multiple dml queries and one or none resultset at the end, then you can do it using scripts.

    create or replace lua script Sample ()
    returns table as
    query([[insert...]]);
    query([[update ...]]);
    exit(query([[select ...]]));
    /
    

    Further I'll describe EXAplus.

    If you want to get results of multiple select statements at one go, then:

    Note that setting "Result tables (retained)" should be chosen (in bottom line of the window) and "Maximum number of open result tabs" should be at least greater than 1 (EXAplus - Preferences... - Other).