Subject Re: [firebird-support] Re: Select works but same in SP does not
Author Mark Deibert
Ok, then I should get -one- record back -without- the For-Do right? I get
all the rows expected when I do a Select from DICE, I get -zero- rows back
when I Select from the SP_LOAD. I can't follow that. I should be getting at
least one back from the SP.


On 7/26/05, Adam <s3057043@...> wrote:
>
> --- In firebird-support@yahoogroups.com, Mark Deibert
> <mark.deibert@g...> wrote:
> > Here is a SP...
> > ALTER PROCEDURE SP_LOAD (
> > GAMEKEY BIGINT,
> > PLAYERKEY BIGINT)
> > RETURNS (
> > PKEY INTEGER,
> > DIEKEY INTEGER,
> > STRIP VARCHAR(24))
> > AS
> > begin
> > select PKEY,DIEKEY,STRIP from DICE
> > where (GAMEKEY=:gamekey and PLAYERKEY=:playerkey)
> > into pkey,diekey,strip;
> > suspend;
> > end
> > I can enter: select PKEY,DIEKEY,STRIP from DICE where GAMEKEY=22
> and
> > PLAYERKEY=6
> > ... and I get back several results row.
> > If I enter: select PKEY,DIEKEY,STRIP from SP_LOAD(22,6)
> > ... I get zero rows.
> > This make no sense to me. Does it make any to you?
>
> Yes it makes perfect sense
>
> Two Problems:
>
> 1. MGA, understand how it works
>
> Are they executed in the same transaction? (I bet not)
>
> Remember that transaction2 can not see records committed by other
> transactions after it (transaction2) has started. If they were
> executed by the same transactions I would expect 1 record returned.
>
> 2. You are only going to get one record back at best. You need to use
> the For .. do syntax to use the procedure like this.
>
> ALTER PROCEDURE SP_LOAD (
> GAMEKEY BIGINT,
> PLAYERKEY BIGINT)
> RETURNS (
> PKEY INTEGER,
> DIEKEY INTEGER,
> STRIP VARCHAR(24))
> AS
> begin
> for select PKEY,DIEKEY,STRIP from DICE
> where (GAMEKEY=:gamekey and PLAYERKEY=:playerkey)
> into pkey,diekey,strip
> do
> begin
> suspend;
> end
> end
>
> Adam
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net 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
>
>
> - Visit your group "firebird-support<http://groups.yahoo.com/group/firebird-support>"
> on the web.
> - To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com<firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------
>



--

L8R,

Mark:-Deibert
> SELECT * FROM Users WHERE Clue> 0
> 0 records returned


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