Subject Re: [IBO] TIBOQuery and selectable SP
Author Ronan van Riet
Hello Paul,

I appreciate your helping me with this problem!

I have not quite "got it" yet. Here is my SQL which is in my TIBQuery ( I
have removed the parameter to simplify my problem )

SELECT o_ROW_ID, o_created, o_last_upd, o_Last_Upd_by, o_projecttype,
o_desc_text, o_Calcdate
FROM SP_GET_MY_PROJECTS

And here is my SP

CREATE PROCEDURE SP_GET_MY_PROJECTS
RETURNS (
O_ROW_ID INTEGER,
O_CREATED DATE,
O_LAST_UPD DATE,
O_PROJECTTYPE VARCHAR(30),
O_DESC_TEXT VARCHAR(10),
O_CALCDATE INTEGER)
AS
begin
FOR
SELECT prj.ROW_ID row_id, prj.created, prj.last_upd,
prj.projecttype, prj.desc_text, prj.stage, prj.calcdate
FROM E_PROJECT prj
into :o_ROW_ID, :o_created, :o_last_upd,:o_projecttype, :o_desc_text,
:o_stage, :o_Calcdate
DO
SUSPEND;
end

When I call

with IBO_QRY_MY_PROJECT do begin
if not prepared then prepare;
IBO_QRY_MY_PROJECT.Active := true;
end;

the error message is 'Invalid request handle'.

Again, what is causing this?

Ronan van Riet

----- Original Message -----
From: Paul Vinkenoog
To: IBObjects@yahoogroups.com
Sent: Monday, January 12, 2004 8:15 PM
Subject: Re: [IBO] TIBOQuery and selectable SP


Hello Ronan,

> I am having problems retrieving a dataset with my TIBOQuery.
>
> My SQL looks like: EXECUTE PROCEDURE
> SP_GET_MY_PROJECTS(:I_CST_CON_ID) SP_MY_PROJECTS can return
> multiple records in the dataset, when I call the SP from IBExpert.

Then it's a selectable stored procedure, but you are calling it like
an executable SP. Change your query's SQL to:

select <field list> from sp_get_my_projects( :i_cst_con_id )
[where... ]
[order by...]

If the procedure were executable and it returned values, you should
add "...returning_values :outputfield1 :outputfield2..." to your
original SQL, and use a TIB_DSQL instead of a query.

> I am using the following code to retieve the dataset.
>
> with IBO_QRY_MY_PROJECT do begin
> Close;
> if not prepared then prepare;
> ParamByName('i_CST_CON_ID').Value :=
> pWebApp.Literal['CST_CON_ID'];
> IBO_QRY_MY_PROJECT.Active := true;
> end;

You don't need the Close; if RefreshOnParamChange is true (the
default) assigning the parameter value will automatically refresh
the query.


Hope this helps,
Paul Vinkenoog



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !




Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/IBObjects/

To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.