Subject RE: [firebird-support] Re: Stored Procedure -- Select
Author Alan McDonald
> Hi,
>
>
> The stored procedure is as follows:
>
> ----------------------------------------------------------
>
> CREATE PROCEDURE QUERY_FOR_USER_ACCESS (
> USER_LOGIN_NAME VARCHAR (50) CHARACTER SET NONE,
> USER_PASSWORD VARCHAR (50) CHARACTER SET NONE,
> STORE_ID INTEGER)
> RETURNS (
> USERNAME VARCHAR (50) CHARACTER SET NONE,
> USERLOGGED CHAR (1) CHARACTER SET NONE,
> USERID INTEGER,
> USERGROUP INTEGER)
> AS
>
> BEGIN
> SELECT
> USERS.logged,
> USERS.name,
> USERS.user_group_id,
> USERS.user_id
>
> FROM
> users,store_user
>
> WHERE
> USERS.userlogin_id = :USER_LOGIN_NAME AND
> USERS.passwd = :USER_PASSWORD AND
> USERS.user_id = store_user.user_id AND
> store_user.store_id = :STORE_ID
>
> INTO
> :USERLOGGED,
> :USERNAME,
> :USERGROUP,
> :USERID;
>
> SUSPEND;
> END

this is only ever going to select one record. If you want to return all the
records, do a
FOR SELECT ....
INTO ... etc
SUSPEND;

Alan

> ----------------------------------------------------------
>
> It does have a SUSPEND, but I'm using the default IB Manager setting,
> so I'm not exactly sure if it's in the right place. Thanks for the
> info on the .NET FB forum group, I'll check there also.
>
> Peter
>
> --- In firebird-support@yahoogroups.com, Pavel Menshchikov
> <developer@l...> wrote:
> > Hello Peter,
> >
> > p> I am using the .NET extension for firebird, and I am calling a
> stored
> > p> procedure (that uses a SELECT statment). There is always at
> minimum 1
> > p> record returned when calling the stored procedure (through .NET
> > p> interface), even when there should be no records. Is this a
> standard
> > p> behavior?
> >
> > Do you have a selectable stored procedure (which SUSPENDs when it
> > needs) in a SELECT statement? Or do you use an executable stored
> > procedure (no SUSPENDs) in a SELECT statement or in / instead of
> > EXECUTE PROCEDURE statement?
> > You also may ask the question in the firebird-net list.
> >
> >
> >
> > --
> > Best regards,
> > Pavel Menshchikov
> > http://www.ls-software.com/
>