Yes it does if your database does support it. A crucial point is to use
a statement separator that doesn't interfere with the one used by the
database. To adjust the statement separator see menu File -> New Session
Properties -> Tab SQL -> lower part of panel
For Oracle, if you have the Oracle Plugin installed, the statement
separator is taken care of automatically.
By the way, your example code didn't work on my Oracle DB (version
12.1.0.2.0). Here's the code that works for me:
DECLARE
v_cant_reg integer;
v_table varchar(300);
BEGIN
v_table := 'Activity_history';
EXECUTE immediate 'select count(*) from ' || v_table into v_cant_reg;
DBMS_OUTPUT.PUT_LINE('v_cant_reg = ' || v_cant_reg);
END;
Note: When the Oracle PLugin is installed there is a tool bar button
"View Oracle Database Output" which allows to see outputs of
DBMS_OUTPUT.PUT_LINE(...)
Gerd
Am 02.04.20 um 21:58 schrieb Marcos Javier Dvoskin:
> Hi,
> I'm using squirrel sql. I would like to know if it supports dynamic sql, that is, to create "On the fly" queys instead of writing direct sql sentences. As an example, below is an extract of an Oracle dynamic sql sentence "Execute inmediate".
> Regards,
> Marcos
> == DYAMIC SQL EXAMPLE===
> declare v_cant_reg integer;
> v_table = "Activity_history" -please note that the table name for the next statement is this variable
> EXECUTE INMEDIATE "select count(*) from " || v_table into v_cant_reg;
>
>
> _______________________________________________
> Squirrel-sql-develop mailing list
> Squ...@li...
> https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
>
|