oracle表字段的增加删除和修改
发布时间:2020-12-12 16:02:25 所属栏目:百科 来源:网络整理
导读:oracle表字段的增加删除和修改 --增加字段alter table luffy.student_test2 add (CDR_CONTENT VARCHAR2(2000));alter table luffy.student_test2 add (COURSE_INST_ID NUMBER(12));alter table luffy.student_test2 add ADDRESS VARCHAR2(40);--删除字段alter
oracle表字段的增加删除和修改
--增加字段 alter table luffy.student_test2 add (CDR_CONTENT VARCHAR2(2000)); alter table luffy.student_test2 add (COURSE_INST_ID NUMBER(12)); alter table luffy.student_test2 add ADDRESS VARCHAR2(40); --删除字段 alter table luffy.student_test2 drop column CDR_CONTENT; alter table luffy.student_test2 drop column PROD_INST_ID; alter table luffy.student_test2 drop column ADDRESS ; --修改字段长度和类型 alter table luffy.student_test2 modify(id number(7));--将字段长度改为7 alter table luffy.student_test2 modify id number(20);--将字段长度改为20 alter table luffy.student_test2 modify(id varchar2(8));--将字段类型由number改为varchar2,长度为8,(要更改类型,需要修改的列必须为空) alter table luffy.student_test2 modify id varchar2(20);--将字段类型由number改为varchar2,长度为20,(要更改类型,需要修改的列必须为空) --修改字段名称 alter table luffy.student_test2 rename column id to stu_id; alter table luffy.student_test2 rename column stu_id to id; --修改表名称 alter table luffy.student_test2 rename to student_test22;--修改表名 rename luffy.student_test22 to student_test2; --不允许指定表的所属用户 --查询某用户下所有的表 select * from dba_tables where owner='ESB_TEST'; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |