SQL> drop table emp;
Table dropped.
SQL> create table emp (empno int,ename varchar2(20), deptno char(10),constraint emp_fk foreign key (deptno) references d
deptno));
Table created.
SQL> desc dept
Name Null? Type
----------------------------------------------------------------------- -------- --------------------------------------
-----
DEPTNO NOT NULL CHAR(15)
DNAME VARCHAR2(20)
SQL> desc emp
Name Null? Type
----------------------------------------------------------------------- -------- --------------------------------------
-----
EMPNO NUMBER(38)
ENAME VARCHAR2(20)
DEPTNO CHAR(10)
SQL> alter table emp modify deptno char(20);
Table altered.
SQL> alter table emp modify deptno varchar2(20);
alter table emp modify deptno varchar2(20)
*
ERROR at line 1:
ORA-02267: column type incompatible with referenced column type
SQL> drop table emp
2 /
Table dropped.
SQL> create table emp (empno int,ename varchar2(20), deptno varchar2(10),constraint emp_fk foreign key (deptno) referenc
pt (deptno));
create table emp (empno int,ename varchar2(20), deptno varchar2(10),constraint emp_fk foreign key (deptno) references de
eptno))
*
ERROR at line 1:
ORA-02267: column type incompatible with referenced column type
SQL>