This may depend on your Oracle DB version or perhaps even on your JDBC
driver. From your error I see you are not using the same JDBC driver as
I do. Mine can be found here:
https://www.oracle.com/database/technologies/jdbc-drivers-12c-downloads.html
Gerd
Am 13.04.20 um 13:51 schrieb Marcos Javier Dvoskin:
> Thanks Gred for your answer.
>
> The code you suggested raises an error. It doesn't accept the declare
> statememt, something strange.
>
> I will try with simple statements, not using dynamic sql
>
> Regards,
>
> Marcos
>
> -----Mensaje original----- De: Gerd Wagner <ger...@t-...>
> Enviado el: sábado, 4 de abril de 2020 18:19 Para: Marcos Javier
> Dvoskin <mdv...@pr...>;
> squ...@li... CC: Natalia Romero Bicego
> <nar...@pr...> Asunto: Re: [Squirrel-sql-develop] Squirrel
> question
>
> 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...
> <mailto:Squ...@li...>
>
>> https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
>
>>
>
|