Subject Re: [firebird-support] Query works but fails in stored procedure
Author Mags Phangisa
Thanks Alan, I'm sure that your are correct. I guess that is what happens
when you don't take a break as you start making silly mistakes.

Much appreciated.


On Fri, Apr 6, 2012 at 1:28 PM, Alan J Davies <
Alan.Davies@...> wrote:

> I don't know what your fields are but it looks like you're trying to
> store the MBRID - presumably identifier - into a date field for output.
> When you just issue a select that will work, but when you use an SP it
> fails. Check your code, or cast(MBRID) as date
>
> Alan J Davies
> Aldis
>
>
> On 06/04/2012 11:42, Mags Phangisa wrote:
> > Hi everyone,
> >
> > The following query works fine when called from the application:
> > "SELECT MBRID,POLNO,PTYPE,BNKDT,AMUNT,
> > ERROR,RECPT
> > from PYMT where BNKDT>='$sttdt' and BNKDT<='$enddt'"
> >
> > However, the following stored procedure (using the same above query)
> throws
> > an error:
> >
> > SET TERM ^ ;
> > CREATE PROCEDURE SPS_PYMT (SDT Date, EDT Date )
> > RETURNS (MBR Date, POL Varchar(20), PTY Char(4), BNK Date, AMU
> > Decimal(10,2), ERR Char(4), REC Varchar(10) )
> > AS
> > BEGIN
> > FOR
> > SELECT MBRID,POLNO,PTYPE,BNKDT,AMUNT,ERROR,RECPT
> > from PYMT where BNKDT>=:SDT and BNKDT<=:EDT
> > INTO :MBR,:POL,:PTY,:BNK,:AMU,:ERR,:REC
> > DO
> > SUSPEND;
> > END^
> >
> > It throws the following error:
> > Conversion error from string "2241" At procedure 'SPS_PYMT' line: 15,
> col: 2
> >
> > This error comes up even when I execute the procedure directly from
> > Flamerobin.
> >
> > This is how I call it in the application, in case it is relevant:
> >
> > $qry = ibase_prepare($tt,"select * from SPS_PYMT('$sttdt','$enddt')");
> > $rslt = ibase_execute($qry);
> > while($rec = ibase_fetch_object($rslt))
> > {
> > ...
> > }
> >
> > Thanx,
> > Mags
> >
> > [Non-text portions of this message have been removed]
> >
> >
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>
>


[Non-text portions of this message have been removed]