trigger
Danny Lewkin
daniel.lewkin at cognosis.be
Wed Oct 3 01:42:36 CDT 2007
Thanks Ivan, that worked!!
Op 2-okt-07, om 18:51 heeft Ivan Smahin het volgende geschreven:
> Hello Danny,
>
> Tuesday, October 2, 2007, 5:27:43 PM, you wrote:
>
>> 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.
> I think NEW.RecID can not be used. It is a very special kind of field.
> Please, try sql-function last_RecID()
>
> Something like this:
> ...
> DECLARE tbl_organisations_lastrecid LONG;
> SET tbl_organisations_lastrecid = SELECT last_RECID();
> ...
>
>
>
> --
> Best regards,
> Ivan Smahin
> Senior Software Engineer
> Paradigma Software, Inc
> Valentina - The Ultra-Fast Database
> http://www.valentina-db.com
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
More information about the Valentina
mailing list