Subject | Re: [ib-support] Problem with stored procedure FB1.0.2 |
---|---|
Author | Johan Leroy |
Post date | 2003-04-14T11:46:37Z |
The problem is that when the sql statement (eg.)
SELECT Stock FROM RESM_STOCK WHERE ItemIdx = :ItemIdx INTO :StockQty;
is executed in the procedure and there is no result for the current ItemIdx,
it containts the result of the previous select where ther was a record for
Itemidx.
eg
Select ... ItemIdx = 5 -> result 10
Select ... itemidx = 1 -> (no record for it) return also 10
I must say that I only have this problem when using stored procedures. In
this case the procedure also manipulated a lot of tables.
regards
Johan
""Martijn Tonies"" <m.tonies@...> schreef in bericht
news:009f01c30276$f4f0bcc0$0a02a8c0@seal...
SELECT Stock FROM RESM_STOCK WHERE ItemIdx = :ItemIdx INTO :StockQty;
is executed in the procedure and there is no result for the current ItemIdx,
it containts the result of the previous select where ther was a record for
Itemidx.
eg
Select ... ItemIdx = 5 -> result 10
Select ... itemidx = 1 -> (no record for it) return also 10
I must say that I only have this problem when using stored procedures. In
this case the procedure also manipulated a lot of tables.
regards
Johan
""Martijn Tonies"" <m.tonies@...> schreef in bericht
news:009f01c30276$f4f0bcc0$0a02a8c0@seal...
> Hi Johan,a
>
> > One of my stored procedures is manipulating a lot of tables and need in
> > loop the data that is writen to the db in this same loop.need
> > The problem I have is that the variables aren't update always when I
> toINTO
> > retrive a null from the database.
>
> Retrieve a NULL where?
>
> > The current sollution I have is to set the var to 0 and then it works.
> Here
> > follows an example
> > StockQty = 0;
> > StockAdaptionQty = 0;
> > SELECT Stock FROM RESM_STOCK WHERE ItemIdx = :ItemIdx
> > :StockQty;will
>
> You mean, if this SELECT doesn't return any rows? 'Cause then STOCKQTY
> stay empty (null).
>
> > SELECT Quantity FROM RESM_STOCK_ADAPTION_DETAILS WHERE
> > ItemIdx = :ItemIdx AND AdaptionIdx =:AdaptionIdx INTO
> :StockAdaptionQty;
> >
> > so if i dont set StockQty and StockAdaptionQty to 0 then I don't get the
> > correct data.
> >
> > Mayby this is a bug in FB or is there any other explination for it.
> >
> >
> > Regards
> >
> >
> > Johan
> >
> > PS: if needed I can send the complete proc source
>
> Better explain what you mean :)
>
>
> With regards,
>
> Martijn Tonies
> Database Workbench - the developer tool for InterBase & Firebird
> Upscene Productions
> http://www.upscene.com
>
> See you at the First European Firebird Conference in May in Fulda, Germany
> http://www.firebird-conference.com
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>