Subject Jaybird and execute block
Author personalsoft_fabiano
Jaybird-2.1.3JDK_1.5

Hi all,

How do i run a execute block with parameters and no return values
using Jaybird?

I'm trying:

java.sql.PreparedStatement stmt = conn.prepareStatement("execute block
(p1 varchar(50) = ?) as begin <stuff> end";
stmt.setString(1, "Test");
stmt.execute();
stmt.close();

org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
SQL Error
SQL error code = -104
Unexpected end of command - line 1, column 1208

My real instruction is this (it runs in IBExpert):

"execute block (" +
" p_codigo varchar(50) = ?," +
" p_grupo varchar(100) = ?," +
" p_descricao varchar(100) = ?," +
" p_ponto_de_acesso varchar(50) = ?," +
" p_customizado char(1) = ?," +
" p_observacoes blob sub_type 1 = ?," +
" p_relatorio blob sub_type 0 = ? )" +
"as" +
" declare variable v_relatorio_id integer;" +
"begin" +
" select" +
" a.numrelatorios" +
" from" +
" relatorios a" +
" where" +
" (a.codigo = :p_codigo)" +
" into" +
" :v_relatorio_id;" +
"" +
" if (v_relatorio_id is not null) then" +
" begin" +
" update relatorios a set" +
" codigo = :p_codigo," +
" grupo = :p_grupo," +
" descricao = :p_descricao," +
" numace1 = coalesce((select u1.numace1 from ace1 u1 where
u1.codigo = :p_ponto_de_acesso), 0)," +
" customizado = :p_customizado," +
" observacao = :p_observacoes," +
" relatorio = :p_relatorio" +
" where" +
" a.numrelatorios = :v_relatorio_id;" +
" end" +
" else" +
" begin" +
" insert into relatorios (" +
" numrelatorios," +
" codigo," +
" grupo," +
" descricao," +
" numace1," +
" customizado," +
" observacao," +
" relatorio )" +
" values (" +
" gen_id(relatorios, 1)," +
" :p_codigo," +
" :p_grupo," +
" :p_descricao," +
" coalesce((select u1.numace1 from ace1 u1 where u1.codigo =
:p_ponto_de_acesso), 0)," +
" :p_customizado," +
" :p_observacoes," +
" :p_relatorio );" +
" end" +
"end;");