Subject Re: [ib-support] Stored Procedure Error - Invalid Request BLR at ofset 218
Author Helen Borrie
At 03:26 PM 18-11-02 +0200, you wrote:
>Hi,
>
>When I am trying to commit this stored procedure using IBO

- using a TIB_Script component, presumably? You cannot use a statement
component (TIB_DSQL, TIB_Cursor) for this as the CREATE PROCEDURE statement
is a composite statement.

Use the SQL property of the script component.

Begin the script with

SET TERM ^;

There are some errors inside your procedure which will cause complications,
too. Try the following to avoid the subselects (fixing errors where required):

create PROCEDURE cp_rec(kaynak_recid numeric (18, 0), hedef_rev numeric
(18,0))
RETURNS (sonuc_recid numeric (18, 0))
AS
declare variable v_tanim varchar(30); /* replace with correct type */
declare variable v_miktar_baz varchar(30); /* replace with correct type */
declare variable v_ano integer; /* replace with correct type */
BEGIN
sonuc_recid = gen_id(GN_REC, 1);

select r.tanim, r.miktar_baz from rec r
where r.id = :kaynak_recid
into :v_tanim, :v_miktar_baz;
/* not legal: select ano from rec_alternatifno_bul hedev_rev */
select ano from rec_alternatifno_bul
where [some criteria to guarantee a scalar result]
into :v_ano;

insert into rec
(ID, TANIM, ID_REV, MIKTAR_BAZ, ALTERNATIF_NO)
values (
:sonuc_recid,
:v_tanim,
:hedef_rev,
:v_miktar_baz,
:v_ano );

END ^
SET TERM ; ^

heLen