Stay with me. If I understand I would create stored function, such as:
CREATE FUNCTION myFunc ( input )
RETURNS Int
{
LANGUAGE JAVA
if (input >= 0 && input<10) return 1
if (input >=10 && input<20) return 2
...
}
Then I would create a column ColXX with somthinhg like:
GENERATED ALWAYS AS ( myFunc( ColRawRate) )
Note: 'ColRawRate' is a Decimal(8,7)
Does this look correct?
Dag H. Wanvik wrote:
>
> pb2208 <[email protected]> writes:
>
>
>> I understand I can use the generated column. The real problem is the
>> second
>> scenario where a number must be assigned to one of several range values.
>
> You can still use a generated column, but having the new value be
> generated by a stored function containing the range logic, based on the
> given column.
>
> Hope this helps!
>
> Dag
>
>
>
-----
Pete Beatty
--
View this message in context:
http://old.nabble.com/Help-with-Triggers-tp28805126p28812402.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.