Subject | Re: [firebird-support] some SQL Question |
---|---|
Author | Helen Borrie |
Post date | 2003-10-30T08:50:44Z |
At 09:36 AM 30/10/2003 +0100, you wrote:
a Before trigger. New.column values are read-only once the Before triggers
have finished.
create trigger bi_sales for sales
active before insert position 0
as
declare variable newcat integer;
begin
select category_id from optician where ID = new.optician_id
into :newcat;
new.category_id = newcat;
end
heLen
>Hi allSetting column values won't work in an After trigger - you have to do it in
>
>Im now working with firebird for a weak or two, and Now im at an intresting
>part of the database..... triggers...
>
>And I can't succeed getting this right.
>
>Table 1
>
>OPTICIAN
> ID,
> NAME,
> CATEGORY_ID
>
>Table 2
>
>SALES
> ID,
> OPTICIAN_ID,
> CATEGORY_ID
>
>I would like after insert on SALES
>
>Select category_id from OPTICIAN where ID = x
>
>Update SALES set CATEGORY_ID = (selected category_id)
>
>Thus anyone have segestions.
a Before trigger. New.column values are read-only once the Before triggers
have finished.
create trigger bi_sales for sales
active before insert position 0
as
declare variable newcat integer;
begin
select category_id from optician where ID = new.optician_id
into :newcat;
new.category_id = newcat;
end
heLen