Under Solaris 2.7 with SAPDB 7.3.0.29 I had some problems when I tried to load the trigger, I solved them just naming evey table with the owner. I mean:
create trigger AB_INSERT for test.A_B after insert execute ( var bname varchar(100); begin call GETNAME(:NEW.ab_a_id, :bname); update test.a set a_b_name = :bname where a_id = :NEW.ab_a_id; end; ) And now it works ok. Frank Peters wrote: > Hi. > Hm, is there really nobody out there interessted in this problem? > I'll just try it a second time: > > 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? > > btw: > this one works: > create trigger AB_INSERT for A_B after insert execute ( > var bname varchar(100); > begin > select b_name from test.B, test.A_B > where A_B.ab_a_id = :NEW.ab_a_id > and A_B.ab_b_id = B.b_id > order by b_name; > fetch first into :bname; > > update a set a_b_name = :bname where a_id = :NEW.ab_a_id; > end; > ) > > thanks > > frank > > -- > (-) Frank Peters > (-) SIGNAL 7 Gesellschaft f�r Informationstechnologie mbH > (-) Br�der-Knau�-Str. 79 - 64285 Darmstadt, > (-) Tel: 06151 665403, Fax: 06151 665373 > (-) [EMAIL PROTECTED], www.signal7.de > > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
