Subject Re: [IBO] Stored Proc Results
Author johnnorthrup34
--- In, Helen Borrie <helebor@t...> wrote:
> At 10:54 PM 30/09/2004 +0000, you wrote:
> >--- In, "Jason Wharton" <jwharton@i...>
> > > > How do I display the results of a stored procedure in a grid?
> > >
> > > Depends on what kind of stored procedure it is.
> > > If it is a procedure for selecting records from then just put a
> > > statement on it and go from there.
> > >
> > > Oh, which grid do you want? That would help too.
> > >
> > > Jason Wharton
> >
> >This procedure has a few select statements and three output
> >parameters. I wanted to use a standard Delphi datasource and DBgrid.
> >Is that possible?
> That wasn't quite the right answer to the question. Do you
understand the
> difference between a selectable stored procedure and an executable
> procedure?
> 1. A selectable SP returns a multi-row dataset. The SP code
contains a
> FOR SELECT...INTO...DO...SUSPEND loop and is called using a SELECT
> statement. (If you don't know the SQL syntax for this, please ask,
or read
> the InterBase language ref manual, or buy my book.) For this, use
either a
> storeproc component or a query component. TIBOQuery is better for this
> than TIBOStoredProc which, though better than the VCL ancestor,
> the nasty ways of the ancestor as well. Hook it to a TDatasource
and you
> can then use the TDBGrid to present it.
> 2. An executable SP returns either no output, or a single-row set of
> output. You execute (not select from) this type of SP. You wouldn't
> normally put this output in a grid control, although there are ways
> you could. You usually read the return values into variables. A
> TIBOStoredProc is OK for this; a TIB_Cursor or a TIB_DSQL is better.
> >Do I use a TIBOStoredProc? You mentioned "put a select statement on
> >it"? How do I accomplish that?
> If it's a selectable SP, use TIBOQuery. You then can treat the dataset
> just like any dsql query, including assigning custom SQL to make it
> "updatable".
> Helen

Thnak you very much. This was very helpful. I had already ordered your
book a few days ago. It should be here on Monday.