Board index » delphi » Stored procedures in views

Stored procedures in views

We are running IB 4.x on HP-UX 10.20 and Delphi applications on the
clients..

I have created a stored procedure which i want to use in a view. When I
enter the select statement of the view, it gives the expected results.
But when i say 'select * from dummyvi' the client looses connection with
the database.
Creation of the view delivers no problem.

Am I doing somthing wrong, is it a bug, is there a workaround?

Thanks,
Geert
-------------------------
create PROCEDURE wockds_id2oms_func2(B smallint, I integer)
returns
(
 wocksd_oms varchar(240)
)
AS
BEGIN
 wocksd_oms = "hallo";
 suspend;
END &
------------------------
CREATE VIEW dummyvi (
 WOCK_CKOTR_ID,
 WOCKSD_OMS
) AS
SELECT
 A.WOCK_CKOTR_ID,
 CAST (( SELECT wocksd_oms FROM
 wockds_id2oms_func2(a.wock_b_id, a.wock_ckotr_id) ) AS varchar(240))
wocksd_oms
FROM WO_CKOTR A;
-----------------------------
select * from dummyvi

 

Re:Stored procedures in views


Quote
Geert Theunissen wrote:

> I have created a stored procedure which i want to use in a view. When I
> enter the select statement of the view, it gives the expected results.
> But when i say 'select * from dummyvi' the client looses connection with
> the database.
> Creation of the view delivers no problem.

> Am I doing somthing wrong, is it a bug, is there a workaround?

        The bug would be that IB even allows this VIEW to be created.  IB does
not support putting stored procs in VIEWs, according to the
documentation.  Subqueries seem to get around this, but since it's not
documented there's no guarantee that it will work.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:Stored procedures in views


Hi,
the same situation if you use SP for "computed" fields. It seems a bug in
IB.
Try to change the view as follow:

create view  V1 (f1, f2, ... ) as
    select (select f1 from sp1(t.ID)) as f1,
             (select f2 from sp1(t.ID)) as f2 ...
        from table1 t

With best regards,
Sergey.

--
I am looking for a job in EU.
I have no a work permit.

Re:Stored procedures in views


or other way

create view  V1 (f1, f2, ... ) as
    select (select f1 from sp1(params) as f1,
             (select f2 from sp1(params)) as f2 ...
       from RDB$DATABASE

With best regards,
Sergey.

Re:Stored procedures in views


Quote
"Sergey Dovganuk" <dovganuk_ser...@mail.ru> wrote in message

news:3BBB336F.284E8D71@mail.ru...

Quote
> Hi,
> the same situation if you use SP for "computed" fields. It seems a bug in
> IB.

Do you have a concrete example of a procedure being called from a computed
field that crashes the server?

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase? WebRing

Re:Stored procedures in views


Hi,
yes, I have.
With best regards,
Sergey.

--
Belgorod-Dnestrovsky Sea Merchant Port
http://www.bdport.com.ua

Other Threads