Subject | Re: [IBO] A problem with a procedure |
---|---|
Author | Helen Borrie |
Post date | 2004-11-26T06:00:57Z |
At 04:51 PM 26/11/2004 +1100, you wrote:
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
>I have a procedure that I call with this string:Yes. A cursor is needed for a stored procedure that loops through a set
>
>'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
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