Different data type for primary and foreign keys
Is it possible that Primary key and foreign keys hav diff. data type?
if No then is below eg valid...what length of deptid is diff in both the tableseg.emp table having (empid varchar2(10),deptid varchar2(25)) --deptid is foreign key dept table having (deptid varchar2(10),deptname varchar2(20) --deptid is primary key
[b]Question asked by visitor sant[/b]
Re: Different data type for primary and foreign keys
Varchar2 data type does pad values with blank spaces. If number of digits is same then it does not matter.
Re: Different data type for primary and foreign keys
Yes of course they can have different data types in a table.
But the foreign key and the PK or unique key of the referenced table should have same datatype.