Ljb :
Thanks your help. Look like add the UNIQUE constraint on it can solve
this problem. Now I know what the problem is. But since our system must
handle multi-company in same time. So we can't let department to be UNIQUE.
What we try to using references in EmployeeInfo are just for check the
department was exist or not. So, we will try to using trigger to do this
check. Well, if need to write our own trigger for each table, we have lots
work to do. :(
Do you know the trigger can apply in inherit table ? If so, then we can
using OOP to resolve this problem (well, reduce our work.) :Q
Many thanks.
"ljb" <lbayuk@mindspring.com> wrote in message
news:9h8nk4$2uf3$1@news.tht.net...
> Lincy.Lin@LinuxInBox.Com wrote:
> >HI !
> >
> > Does anyone know what's my problem and how to resolve it ? Thanks.
> >...
> >> Create Table DepartmentInfo
> >> (
> >>...
> >> Department Char(40) Default ''
> >> );
> >>...
> >> Create Table EmployeeInfo
> >> (
> >>...
> >> Department Char(40) References
> >> DepartmentInfo (Department)
> >>...
> >> ERROR: UNIQUE constraint matching given keys for referenced
table
> >> "departmentinfo" not found
>
> Make DepartmentInfo.Department a primary key. If not possible, make a
> unique constraint on it. If it isn't unique, you shouldn't be referencing
> it as a foreign key from EmployeeInfo.