Subject | Re: [IBO] Select SP |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-06-20T22:12:36Z |
Hello Alejandro,
exactly as you would for a "regular query". This is not some special
IBO feature by the way - it's an SQL feature.
Example: I just wrote a selectable SP because I needed some behaviour
that I couldn't get from a table or view. I already had a TIB_Query
for the table in question. All I had to do when the SP was finished
was change the FROM part of the TIB_Query's SQL (I named the SP's
output parameters after the table's fields).
Here's the SP:
create procedure AktieveAfdInfoMetDefaults
returns ( afdeling_id integer,
bedrijf_id integer,
afdelingsnaam varchar( 40 ),
soortwerkplek varchar( 40 ),
kontaktpersoon varchar( 40 ),
kontaktpers_mv char( 1 ),
stagebegeleider varchar( 40 ),
stagebeg_mv char( 1 ) )
as
declare variable <blah...> ;
begin
...
<start loop>
...
(output params get values in loop)
suspend;
<end loop>
end
And this is the SQL property of my TIB_Query:
SELECT AFDELING_ID
, BEDRIJF_ID
, AFDELINGSNAAM
, SOORTWERKPLEK
, KONTAKTPERSOON
, KONTAKTPERS_MV
, STAGEBEGELEIDER
, STAGEBEG_MV
FROM AktieveAfdInfoMetDefaults
ORDER BY AFDELINGSNAAM
Like I said: just like querying a regular table, view, join or
whatever. The output params of the SP serve as field names.
Greetings,
Paul Vinkenoog
> How to use a Select Stored Procedure in a TIB_Query?It's surprisingly easy: for a selectable SP, you set up your query
> Would anybody have an example?
exactly as you would for a "regular query". This is not some special
IBO feature by the way - it's an SQL feature.
Example: I just wrote a selectable SP because I needed some behaviour
that I couldn't get from a table or view. I already had a TIB_Query
for the table in question. All I had to do when the SP was finished
was change the FROM part of the TIB_Query's SQL (I named the SP's
output parameters after the table's fields).
Here's the SP:
create procedure AktieveAfdInfoMetDefaults
returns ( afdeling_id integer,
bedrijf_id integer,
afdelingsnaam varchar( 40 ),
soortwerkplek varchar( 40 ),
kontaktpersoon varchar( 40 ),
kontaktpers_mv char( 1 ),
stagebegeleider varchar( 40 ),
stagebeg_mv char( 1 ) )
as
declare variable <blah...> ;
begin
...
<start loop>
...
(output params get values in loop)
suspend;
<end loop>
end
And this is the SQL property of my TIB_Query:
SELECT AFDELING_ID
, BEDRIJF_ID
, AFDELINGSNAAM
, SOORTWERKPLEK
, KONTAKTPERSOON
, KONTAKTPERS_MV
, STAGEBEGELEIDER
, STAGEBEG_MV
FROM AktieveAfdInfoMetDefaults
ORDER BY AFDELINGSNAAM
Like I said: just like querying a regular table, view, join or
whatever. The output params of the SP serve as field names.
> How to exhibit an image in TIB_CtrlGrid?Sorry, no idea.
> Would anybody have an example?
Greetings,
Paul Vinkenoog