oracle修改表结构精度,常见问题--oracle10g修改表结构
1.修改表结构
语法: alter table table_name modify (列名 数据类型)
示例:
9:54:25 SQL> alter table dbtest_dw_cust_order modify (co_seq number(4));
Table altered
9:55:22 SQL> alter table dbtest_dw_cust_order modify (co_seq number(2));
alter table dbtest_dw_cust_order modify (co_seq number(2))
ORA-01440: 要减小精度或标度, 则要修改的列必须为空
注意:修改表结构的时候注意精度,如果要减小精度或标度, 则要修改的列必须为空
2.增加一个列
语法:alter table table_name add (列名 数据类型)
10:12:18 SQL> alter table dbtest_dw_cust_order add (dbtest number);
Table altered
10:11:42 SQL> alter table dbtest_dw_cust_order add (dbtest number not null);
alter table dbtest_dw_cust_order add (dbtest number not null)
ORA-01758: 要添加必需的 (NOT NULL) 列, 则表必须为空
注意:要添加必需的 (NOT NULL) 列, 则表必须为空
3.修改列名
语法:alter table 表名 rename column 当前列名 to 新列名
示例:
10:23:40 SQL> alter table dbtest_dw_cust_order rename column dbtest to dbtest123;
Table altered
4.删除一个列
语法:alter table 表名 drop column 列名
示例:
10:24:30 SQL> alter table dbtest_dw_cust_order drop column dbtest123;
Table altered
总结
以上是生活随笔为你收集整理的oracle修改表结构精度,常见问题--oracle10g修改表结构的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: oracle db file seque
- 下一篇: oracle循环的方式,Oracle 的