Subject | Re: [firebird-support] TRIGGER: Recording Integer instead of Numeric(4,2) |
---|---|
Author | Ann W. Harrison |
Post date | 2005-06-20T21:44:09Z |
Carol Milius wrote:
to do is, after an update of TABLE1, if the value of UA changes
For each record in TABLE2
select the values of two fields
update all records in TABLE2 setting
UA field = the selected value from the outer loop
divided by the new value from TABLE1
I don't know the data type of the UA field in TABLE2, or why
you need to update every record once for every record in the table.
Regards,
Ann
>Yes. Could you restate the problem. What your procedure below appears
> After Update Table1 the Table2 needs some processing.
>
> The trigger below is recording (posting) Integer instead of Numeric(4,2).
>
> Any sugestions?
to do is, after an update of TABLE1, if the value of UA changes
For each record in TABLE2
select the values of two fields
update all records in TABLE2 setting
UA field = the selected value from the outer loop
divided by the new value from TABLE1
I don't know the data type of the UA field in TABLE2, or why
you need to update every record once for every record in the table.
Regards,
Ann
>
> CREATE TRIGGER TABLE1_AU0 FOR TABLE1
> ACTIVE AFTER UPDATE POSITION 0
> AS
> declare variable VAR_PESOMEDIO integer;
> declare variable VAR_UA numeric(4,2);
>
> begin
> if (NEW.UA <> OLD.UA) then
> begin
> for
> select PESOMEDIO, UA
> from TABLE2
> into :VAR_PESOMEDIO, :VAR_UA
> do
> update TABLE2
> set UA = :VAR_PESOMEDIO / NEW.UA);
> end
> end
>