Subject | Re: [firebird-support] Query works but fails in stored procedure |
---|---|
Author | Alan J Davies |
Post date | 2012-04-06T11:28:27Z |
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
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]
>
>