Subject | Re: [firebird-support] Definig variable as a domain |
---|---|
Author | Helen Borrie |
Post date | 2010-03-15T07:16:12Z |
At 05:13 PM 15/03/2010, you wrote:
You might be able to bend fortune by referring to the NEW context array (assuming that those arguments are columns in BUDGETENTRY):
ALTER TABLE BUDGETENTRY ADD TAXAMOUNT COMPUTED BY ((SELECT TAXAMOUNT FROM P_TAX_AMOUNT(new.TOTALVALUE_EXTAX, new.TAXRATEID)));
But I wouldn't hold my breath. You don't seem overly concerned about the likely precision errors you are laying into this SP. If you want a function, write a UDF.
./heLen
>Thanx Helen. Can you clarify what is the difference betweenPERCENTAGE is not a data type. The TYPE OF keyword signals to the engine that you want the variable to have the same data type as the data type of the named domain. Note that any constraints applicable to the domain do apply to the variable.
>
>DECLARE VARIABLE RATE PERCENTAGE;
>and
>declare variable RATE TYPE OF PERCENTAGE;
>I will try your approach.Try reading the Fb 2.1 release notes, too.
>As for the actual calculation itself, I should have mentioned that the error happens in the SELECT query attempting to stick a value into :RATEA parameter?
>But why would it work when called directly, vs a SELECT that runs the same proceudre via a COMPUTED BY column? Seems more to me to be a bug with COMPUTED columns.A computed column must return a scalar. You should also be aware that a stored procedure is not a function.
You might be able to bend fortune by referring to the NEW context array (assuming that those arguments are columns in BUDGETENTRY):
ALTER TABLE BUDGETENTRY ADD TAXAMOUNT COMPUTED BY ((SELECT TAXAMOUNT FROM P_TAX_AMOUNT(new.TOTALVALUE_EXTAX, new.TAXRATEID)));
But I wouldn't hold my breath. You don't seem overly concerned about the likely precision errors you are laying into this SP. If you want a function, write a UDF.
./heLen