Oracle modifies the field type and length, and oracle modifies the field
Modify the field name in Oracle
Alter table name rename column old field name to new field name
Modify the field type and length in Oracle
Alter table name modify Field Name Data Type
If you modify the data type from varchar2 to int and the field has a value, the following error is reported:
Reference solution: http://blog.csdn.net/itmyhome1990/article/details/8681206
Reprinted please indicate the source: http://blog.csdn.net/itmyhome1990/article/details/38869647
What is the operation for changing the field name in oracle?
Use the rename keyword to modify the field name: alter table name rename column old field name to new field name;
Use the modify keyword to modify the Data Type: alter table name modify Field name data type;
How can I change the field size of a table created in oracle?
Supplement the second floor
The field type is
If you want to change the value to a smaller value, you can directly use alter table table_name modify column datatype;
If there is any data, the data may be lost.
For example:
Table: stu (name varchar2 (20) should change the length of field name to 10
The table contains a piece of data: the length of name (the name is more than 10 in Huaxi Village, China), and data must be lost when captured.
Of course, if the data length in the table is less than 10, you can use the SQL statement segment to directly deal with it.
Begin
Alter table stu add (name2 varchar2 (10); add a new field
Update stu set name2 = substr (trim (name),); assign a value to the new field
Alter table stu drop (name); Delete the original field
Alter table stu rename column name2 to name; rename the new field
End;