List:MaxDB« Previous MessageNext Message »
From:Frank Peters Date:February 21 2003 10:08am
Subject:Problem with calling dbProcs in triggers
View as plain text  
Hi.
I couldn't find an answer neither in the documentation nor the list, so 
maybe someone can give me a hint:
I want to call a dbproc from within a trigger and use the result later on.
Simple testcase:

create table A (
   a_id     varchar(32) primary key,
   a_name   varchar(100),
   a_b_name varchar(100)
)
//
create table B (
   b_id     varchar(32) primary key,
   b_name   varchar(100)
)
//
create table A_B(
   ab_a_id  varchar(32) references A(a_id),
   ab_b_id  varchar(32) references B(b_id),
   primary key(ab_a_id, ab_b_id)
)
//
create dbproc GETNAME( in aid varchar(32), out bname varchar(100))  as
begin
    select b_name from test.B, test.A_B
    where A_B.ab_a_id = :aid
    and A_B.ab_b_id = B.b_id
    order by b_name;
    fetch first into :bname;
end;

This works fine so far; now for the trigger:
//
create trigger AB_INSERT for A_B after insert execute (
var bname varchar(100);
begin
   call GETNAME(:NEW.ab_a_id, :bname);
   update a set a_b_name = :bname where a_id = :NEW.ab_a_id;
end;
)

trying to create this gives
"Integrity constraint violation; -8006 POS(1) Data types must be 
compatible."

It seems that the problem is with the IN-Parameter, but i don't 
understand why and how to make it work.
Any ideas anyone?

thanks

frank

oh, yes: system is 7.3.0.30

-- 
(-) Frank Peters
(-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665403, Fax: 06151 665373
(-) peters@stripped, www.signal7.de


Thread
Problem with calling dbProcs in triggersFrank Peters21 Feb