oracle怎么改字段,oracle 改字段

Oracle修改字段名、字段数据类型

语句:

目前创新互联建站已为成百上千的企业提供了网站建设、域名、虚拟空间、网站托管运营、企业网站设计、黄陵网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

alter table tableName rename column oldCName to newCName; -- 修改字段名

alter table tableName modify (cloumnName 数据类型); -- 修改数据类型

例如:

1、创建表:

CREATE TABLE Student(

id varchar2(32) primary key,

name varchar2(8) not null,

age number

);

2、修改字段名:

alter table Student rename column name to StuName;

3、修改数据类型:

alter table Student modify (id varchar2(64));

清醒时做事,糊涂时读书,大怒时睡觉,独处时思考;做一个幸福的人,读书,旅行,努力工作,关心身体和心情,成为最好的自己

oracle 修改字段名, 字段长度的操作是什么?

1、创建表:

CREATE TABLE Student(

id varchar2(32) primary key,

name varchar2(8) not null,

age number

);

2、修改字段名:

alter table Student rename name to StuName;

3、修改数据类型:

alter table Student modify (id varchar2(64));

Oracle数据库介绍:

Oracle Database,又名Oracle RDBMS,或简称Oracle。是甲骨文公司的一款关系数据库管理系统。它是在数据库领域一直处于领先地位的产品。可以说Oracle数据库系统是目前世界上流行的关系数据库管理系统,系统可移植性好、使用方便、功能强,适用于各类大、中、小、微机环境。它是一种高效率、可靠性好的 适应高吞吐量的数据库解决方案。

oracle中怎么更改表中字段名

首先方法是使用RENAME关键字:

修改字段名:alter table 表名 rename column 现列名 to 新列名;

修改表名:alter table 表名 rename to 新表名

增加字段语法:alter table tablename add (column datatype [default value][null/not null],….);

说明:alter table 表名 add (字段名 字段类型 默认值 是否为空);

例:alter table sf_users add (HeadPIC blob);

例:alter table sf_users add (userName varchar2(30) default '空' not null);

修改字段的语法:alter table tablename modify (column datatype [default value][null/not null],….);

说明:alter table 表名 modify (字段名 字段类型 默认值 是否为空);

例:alter table sf_InvoiceApply modify (BILLCODE number(4));

删除字段的语法:alter table tablename drop (column);

说明:alter table 表名 drop column 字段名;

例:alter table sf_users drop column HeadPIC;

字段的重命名:

说明:alter table 表名 rename  column  列名 to 新列名   (其中:column是关键字)

例:alter table sf_InvoiceApply rename column PIC to NEWPIC;

表的重命名:

说明:alter table 表名 rename to  新表名

例:alter table sf_InvoiceApply rename to  sf_New_InvoiceApply;


本文标题:oracle怎么改字段,oracle 改字段
网站链接:http://lszwz.com/article/dsippcs.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款