Subject Re: [IBO] A problem with a procedure
Author Helen Borrie
At 04:51 PM 26/11/2004 +1100, you wrote:

>I have a procedure that I call with this string:
>
>'SELECT * FROM P_LP_SELECT_ONE (:LP_PROCESSNAME_IN)'
>
>The procedure is as follows:
>
>BEGIN
> SELECT
> LP_PROCESSNAME,
> LP_LOGMASK,
> LP_LOGPATH,
> LP_DAYLIMIT
> FROM
> LOGPARAMS
> WHERE
> UPPER(LP_PROCESSNAME) = UPPER(:LP_PROCESSNAME_IN)
> INTO
> :LP_PROCESSNAME,
> :LP_LOGMASK,
> :LP_LOGPATH,
> :LP_DAYLIMIT;
> SUSPEND;
>END
>
>
>When there are no records in the database my code:
>
> bool PrepareDatabase(void)
> {
> if(FCursor)
> {
> FCursor->Execute();
> FCursor->First();
> }
>
> return FCursor && !FCursor->Eof;
> }
>
>indicates it found a record (ie, FCursor->Eof == false). If I remove the
>SUSPEND from the end of the procedure then it works.
>
>Can this be explained ? Should I remove the SUSPEND

Yes. A cursor is needed for a stored procedure that loops through a set
and outputs (potentially) multiiple rows. A cursor is established in a SP
with a FOR..SELECT loop. You use SUSPEND for cursors.

Your SP isn't a selectable SP, it's an executable one. It has no cursor.
You should be calling the procedure by calling the Execute method on an
EXECUTE PROCEDURE statement and reading the Fields[] array to get the
result. Use TIB_Cursor or TIB_DSQL for your statement object.

Helen