Subject Re: [ib-support] Stored Procedure
Author Milan Babuskov
Jorez A. Nasato wrote:
> Hi!
>
> I need a sp that returns 1 (one) value from a table, and this value
> can't be null, I'm sending my script and if someone could help saying
> where is my mistake it will be good.

Can you tell us what does the script do when you run it... does it work at
all?
Do you get some error messages?

> select
> cast(ch.ch_valor as decimal(4,4))
> from
> ch
> where
> ( ch.ch_convenio = :convenio_ch ) and
> ( ch.ch_data <= :data_ch )
> order by
> ch.ch_data desc
> into :valor_ch;

This should return only one row, right? Why do you use order by?

--

Milan Babuskov
http://sourceforge.net/projects/fbexport