You need to delete the foreign key and primary key first, and store data by creating temporary fields (to reserve the customer's original data ), finally, re-establish the primary key and foreign key 1. Delete the relationship between the primary key and foreign key "the column type is not compatible with the referenced column type" alter table Name drop constraint relationship name; 2. Run the following statement to report "to modify the data type, the column to be changed must be blank"
Alter table name modify (target field varchar2 (100 ));
Solution:
Step 1: Add a temporary field to the table
Alter table name add temporary field Original Type of target field;
Step 2: pay the value of the target field to the temporary field and leave the target field empty.
Update table name set temporary field = target field, target field = null;
Step 3: Modify the target type
Alter table name modify target field varchar2 (100 );
Step 4: pay the value of the temporary field to the target field and leave the temporary field empty.
Update table name set target field = temporary field, temporary field = null;
The last step is to delete temporary fields.
Alter table Name drop column temporary field;
3. Create a primary key-foreign key relationship
Alter table primary key table add constraint PK_CC_NAME primary key (field name)
Using index
Tablespace *** pctfree 10
Initrans 2
Maxtrans 255
Storage
(
Initial 64 K
Minextents 1
Maxextents unlimited
);
Alter table foreign key table add constraint FK_CC_NAME foreign key (field name)
References primary key table (field name );