trigger

Danny Lewkin daniel.lewkin at cognosis.be
Tue Oct 2 09:27:43 CDT 2007


Hi List,

I have this trigger :

CREATE OR REPLACE TRIGGER "trigger_tbl_organisations_typelist_AI"  
AFTER INSERT
ON "tbl_organisations" REFERENCING NEW AS newRow
	FOR EACH ROW
	WHEN NEW.objptr_org IS NULL
     	BEGIN
	
	DECLARE mylastrecid LONG;
	
	insert into tbl_typelists 
(created_by,typelistname,objptr_organisation) values  
('cm_spBuildUserTypes','comppooltypes', NEW.RecID);
	set mylastrecid = select recid FROM tbl_typelists where typelistname  
= 'comppooltypes'AND objptr_organisation = NEW.RecID;
	insert into tbl_typelistvalues 
(displayname,listvalue,objptr_typelist) values ('Technisch', 
1,mylastrecid);
	insert into tbl_typelistvalues 
(displayname,listvalue,objptr_typelist) values ('Praktisch', 
2,mylastrecid);
END;

If I insert a new record into tbl_organisations like this 'INSERT  
INTO tbl_organisations(org_name) VALUES('test') these things happen:

- record into tbl_organisations is inserted, with org_name "test", so  
that's correct
- i get a error : Error : KErnel error: 0x21501. It's too few values.
- in tbl_typelists a record is inserted with displayname  
'comppooltypes', but objptr_organisation is WRONG! It's '1' which is  
a record that already exsisted!
- int tbl_typelistvalues non records are created...

So, 'simple' question, why? What am I doing wrong?

Greetz,

Danny


More information about the Valentina mailing list