Subject | Re: [IBO] Stored Proc Results |
---|---|
Author | Helen Borrie |
Post date | 2004-09-30T23:24:43Z |
At 10:54 PM 30/09/2004 +0000, you wrote:
difference between a selectable stored procedure and an executable stored
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, inherits
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 that
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.
just like any dsql query, including assigning custom SQL to make it
"updatable".
Helen
>--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@i...> wrote:That wasn't quite the right answer to the question. Do you understand the
> > > 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 select
> > 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?
difference between a selectable stored procedure and an executable stored
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, inherits
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 that
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 onIf it's a selectable SP, use TIBOQuery. You then can treat the dataset
>it"? How do I accomplish that?
just like any dsql query, including assigning custom SQL to make it
"updatable".
Helen