Subject Re: [ib-support] problem with Employee database
Author Helen Borrie
At 06:12 PM 16-08-02 -0300, Ernesto Cullen wrote:
>Hi all
> I am studying 'Employee' Database which comes with Interbase.
> I have trouble when i try to update any record in table
> Salary_History. I know that this table is updated automatically when
> employee' salary changes; but i can see no reason to not be able to edit
> the history directly. It says: 'Validation error for column OLD_SALARY,
> value "0.00 ". OLD_SALARY is declared as type
> SALARY, which is Numeric(15,2).
>
>Any ideas?

If you inspect the metadata surrounding this table, you'll see that it has
a CHECK constraint on PERCENT_CHANGE that affects the relationship between
OLD_SALARY and the computed column NEW_SALARY.

If I do
update salary_history
set old_salary=0.00
where emp_no=20

then I get your error:
ISC ERROR MESSAGE:
validation error for column OLD_SALARY, value "0.00 "

because the requested change violates the CHECK constraint.

If I do
update salary_history
set old_salary=85500.00
where emp_no=20

then there is no error, because the change to old_salary keeps the
percent_change within the range restricted by the CHECK constraint.

heLen

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
______________________________________________________________________