Subject | Re: [IBO] Error with stored procedure on TIBOQUERY "Can not SELECT RDB$DB_KEY" |
---|---|
Author | davissammybr |
Post date | 2010-08-05T00:22:43Z |
I changed the property to readonly but did not work.
Below is the ddl and the query.
Thanks.
Query with error on TiboQuery:
select
Mylist.paramkey,
Mylist.paramname
from
p_list Mylist
/******************************************************************************/
/*** Stored Procedures ***/
/******************************************************************************/
CREATE PROCEDURE P_LIST
RETURNS (
PARAMNAME VARCHAR(100),
PARAMKEY VARCHAR(10))
AS
BEGIN
SUSPEND;
END^
SET TERM ; ^
/******************************************************************************/
/*** Tables ***/
/******************************************************************************/
CREATE TABLE TBL_DETAIL (
C_KEY VARCHAR(10) NOT NULL,
C_NAME VARCHAR(100)
);
/******************************************************************************/
/*** Primary Keys ***/
/******************************************************************************/
ALTER TABLE TBL_DETAIL ADD CONSTRAINT PK_TBL_DETAIL PRIMARY KEY (C_KEY);
/******************************************************************************/
/*** Stored Procedures ***/
/******************************************************************************/
SET TERM ^ ;
ALTER PROCEDURE P_LIST
RETURNS (
PARAMNAME VARCHAR(100),
PARAMKEY VARCHAR(10))
AS
begin
/* Procedure Text */
FOR
select
detail.c_key,
detail.c_name
from
tbl_detail detail
into :PARAMKEY, :PARAMNAME
DO
BEGIN
suspend;
END
end^
SET TERM ; ^
Below is the ddl and the query.
Thanks.
Query with error on TiboQuery:
select
Mylist.paramkey,
Mylist.paramname
from
p_list Mylist
/******************************************************************************/
/*** Stored Procedures ***/
/******************************************************************************/
CREATE PROCEDURE P_LIST
RETURNS (
PARAMNAME VARCHAR(100),
PARAMKEY VARCHAR(10))
AS
BEGIN
SUSPEND;
END^
SET TERM ; ^
/******************************************************************************/
/*** Tables ***/
/******************************************************************************/
CREATE TABLE TBL_DETAIL (
C_KEY VARCHAR(10) NOT NULL,
C_NAME VARCHAR(100)
);
/******************************************************************************/
/*** Primary Keys ***/
/******************************************************************************/
ALTER TABLE TBL_DETAIL ADD CONSTRAINT PK_TBL_DETAIL PRIMARY KEY (C_KEY);
/******************************************************************************/
/*** Stored Procedures ***/
/******************************************************************************/
SET TERM ^ ;
ALTER PROCEDURE P_LIST
RETURNS (
PARAMNAME VARCHAR(100),
PARAMKEY VARCHAR(10))
AS
begin
/* Procedure Text */
FOR
select
detail.c_key,
detail.c_name
from
tbl_detail detail
into :PARAMKEY, :PARAMNAME
DO
BEGIN
suspend;
END
end^
SET TERM ; ^
--- In IBObjects@yahoogroups.com, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
>
> I don't know what is wrong, but I react to using LIST as the name of the alias (it is an aggregate function in Firebird 2.1). If changing from List to MyList doesn't help: I think IBO adds RDB$DB_KEY to queries where there is no defined key. Maybe it can be avoided by explicitly setting your TIBOQuery to ReadOnly? Or set EditSQL, InsertSQL explicitly (don't know whether they exist in TIBOQuery, I mostly use TIB_Cursor myself and occasionally TIB_Query).
>
> HTH,
> Set
>
> Davissammybr wrote:
>
> I have a stored procedure that when performed on IBExpert no error.
> But when I run it on the component TIBOQuery get the following message:
>
> Can not SELECT RDB$DB_KEY from a stored procedure.
>
> The stored procedure returns a field called IP.
> When I run it generates error as below:
>
> select
> list.ip
> from
> My_StoredProcedure list
>
> If you run this way the error does not happen;
>
> select
> ip
> from
> My_StoredProcedure
>
> What is wrong?
> Thank you.
>