Subject | Re: [Firebird-Java] SP with returning value error |
---|---|
Author | Francisco Antonio Vieira Souza |
Post date | 2004-08-10T17:32:48Z |
Rick DeBay wrote:
importante, how it is working, it is not necessary to use the
CallableStatement, have a look:
PreparedStatement p = c.prepareStatement("SELECT * FROM
SP_SET_SALVAR_DOCUMENTO_RECEBER(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
p.setString(1, tipo_recebimento);
p.setString(2, id_tomador);
p.setString(3, documento_origem);
p.setString(4,documento_gerado);
p.setBigDecimal(5, perc_desconto);
p.setBigDecimal(6, perc_juros);
p.setBigDecimal(7, valor_desconto);
p.setBigDecimal(8, valor_receber);
p.setBigDecimal(9, valor_total);
p.setDate(10,data_emissao);
p.setTime(11,hora_emissao);
p.setDate(12, data_vencimento);
p.setString(13, descricao);
p.setString(14, boleto);
ResultSet rs = p.executeQuery();
if(rs.next())
{
numero_gerado = rs.getInt("DOCUMENTO_GERADO");
} rs.close();
p.close();
> You left out the FROM keyword.Thank you for the answer, yes you were write, I had left out something
> And you may need to use a CallableStatement instead of
> PreparedStatement. I'm not to clear on that part, and would like
> clarification myself.
importante, how it is working, it is not necessary to use the
CallableStatement, have a look:
PreparedStatement p = c.prepareStatement("SELECT * FROM
SP_SET_SALVAR_DOCUMENTO_RECEBER(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
p.setString(1, tipo_recebimento);
p.setString(2, id_tomador);
p.setString(3, documento_origem);
p.setString(4,documento_gerado);
p.setBigDecimal(5, perc_desconto);
p.setBigDecimal(6, perc_juros);
p.setBigDecimal(7, valor_desconto);
p.setBigDecimal(8, valor_receber);
p.setBigDecimal(9, valor_total);
p.setDate(10,data_emissao);
p.setTime(11,hora_emissao);
p.setDate(12, data_vencimento);
p.setString(13, descricao);
p.setString(14, boleto);
ResultSet rs = p.executeQuery();
if(rs.next())
{
numero_gerado = rs.getInt("DOCUMENTO_GERADO");
} rs.close();
p.close();