Subject | RE: [IBO] A problem with a procedure |
---|---|
Author | Helen Borrie |
Post date | 2004-11-29T03:40:08Z |
Malcolm,
I'll insert my comment here as I know Jason won't answer this until
tomorrow, due to Sabbath observance...
At 12:34 PM 29/11/2004 +1100, you wrote:
multi-row dataset.
executable procedure and read its Fields[] array after execution.
TIB_Cursor is a workhorse multi-purpose class that can handle both types of
procedure. However, you must call the appropriate methods:
-- if you want a dataset, you need a SELECT statement and the procedure
itself must be a selectable SP, in order for there to be a cursor. You
call First() to execute this -- this executes the selectable SP and causes
it to output the first row of the set and exit from SUSPEND mode.
-- if you want a one-and-one-only row set returned (as the architecture of
your SP dictates) then you use EXECUTE PROCEDURE in your SQL property and
you call Execute to execute it. After that, read Fields[], which is a
single TIB_Row. There is no cursor associated with an executable SP, hence
the error you are getting by calling First().
you initialise the return arguments. Inside the procedure, they are just
variables. PSQL doesn't do any magic in this respect...
Helen
I'll insert my comment here as I know Jason won't answer this until
tomorrow, due to Sabbath observance...
At 12:34 PM 29/11/2004 +1100, you wrote:
>Jason,This is an executable procedure, i.e. it does not and can not return a
>
>The exception (invalid handle) is raised on the line 'FCursor->First();'
>
>Due to time factors I have had to find a workaround. Using the exact same
>code but changing:
>
> SQL_LOGPARAMSSELECT = 'EXECUTE PROCEDURE P_LP_SELECT_ONE
>(:LP_PROCESSNAME_IN)';
>
>to
>
> SQL_LOGPARAMSSELECT = 'SELECT * FROM LOGPARAMS WHERE LP_PROCESSNAME =
>:LP_PROCESSNAME_IN';
>
>works as I require. Just for reference, the current procedure is defined
>as:
>
>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;
>END
>
>
>BTW, the procedure works as expected in Database Workbench.
multi-row dataset.
>The error occurs when there is no data to be found in the table.You should always initialise the return arguments in stored procedures.
>Additionally, when there is data, it does not return the data. If theEither define a selectable procedure and SELECT from it, or define an
>problem is in my code then I have no idea where it is ????
executable procedure and read its Fields[] array after execution.
TIB_Cursor is a workhorse multi-purpose class that can handle both types of
procedure. However, you must call the appropriate methods:
-- if you want a dataset, you need a SELECT statement and the procedure
itself must be a selectable SP, in order for there to be a cursor. You
call First() to execute this -- this executes the selectable SP and causes
it to output the first row of the set and exit from SUSPEND mode.
-- if you want a one-and-one-only row set returned (as the architecture of
your SP dictates) then you use EXECUTE PROCEDURE in your SQL property and
you call Execute to execute it. After that, read Fields[], which is a
single TIB_Row. There is no cursor associated with an executable SP, hence
the error you are getting by calling First().
>For now I'll have to use the SQL statement as indicated above.Really, you only have to call the correct methods...and DO make sure that
you initialise the return arguments. Inside the procedure, they are just
variables. PSQL doesn't do any magic in this respect...
Helen