将oracle的create语句更改为alter语句使用
编程学习 2021-07-05 16:08www.dzhlxh.cn编程入门
本文将详细介绍oracle的create语句更改为alter语句使,需要了解更多的朋友可以参考下
看PD中,双击某个表,查看其preview标签,然后会发现有某个表的create语句,如下:
create table Company_Info (
Company_ID NVARCHAR2(50) not null,
Area_ID NVARCHAR2(50),
Mem_ID NVARCHAR2(50),
Level_Id NVARCHAR2(50),
Name NVARCHAR2(50) not null,
Capital NVARCHAR2(50),
Unit_Property NUMBER(2) not null,
Economics_type NUMBER(2) not null,
Man_Scale NUMBER(10,0),
License_Code NVARCHAR2(50),
License_Img NVARCHAR2(50),
Intro NVARCHAR2(3000),
Company_Img NVARCHAR2(200),
Address NVARCHAR2(200),
Postal_Code NVARCHAR2(50),
Tel NVARCHAR2(50),
Fax NVARCHAR2(50),
Mobile NVARCHAR2(50) not null,
Email NVARCHAR2(50) not null,
Contactor_sex NUMBER(2),
Contactor NVARCHAR2(50),
Web_Site NVARCHAR2(200),
View_Count NUMBER(20,0),
Create_Date DATE not null,
Update_Date DATE not null,
Status NUMBER(2),
Company_Type NUMBER(2),
Remain_Point NUMBER(6,0),
Cmp_Level NVARCHAR2(50),
isAdv NUMBER(2),
Expri_Date DATE,
Display_index NUMBER(6,0),
constraint PK_COMPANY_INFO primary key (Company_ID)
);
我们如果加了某些字段,又要在原数据库上加上这些字段,我们可以这样:把create变为alter,然后将不要的
字段去除,如下所示:
alter table Company_Info add(
Remain_Point NUMBER(6,0),
Cmp_Level NVARCHAR2(50),
isAdv NUMBER(2),
Expri_Date DATE,
Display_index NUMBER(6,0)
)
这样就加快了我们的开发效率.
代码如下:
create table Company_Info (
Company_ID NVARCHAR2(50) not null,
Area_ID NVARCHAR2(50),
Mem_ID NVARCHAR2(50),
Level_Id NVARCHAR2(50),
Name NVARCHAR2(50) not null,
Capital NVARCHAR2(50),
Unit_Property NUMBER(2) not null,
Economics_type NUMBER(2) not null,
Man_Scale NUMBER(10,0),
License_Code NVARCHAR2(50),
License_Img NVARCHAR2(50),
Intro NVARCHAR2(3000),
Company_Img NVARCHAR2(200),
Address NVARCHAR2(200),
Postal_Code NVARCHAR2(50),
Tel NVARCHAR2(50),
Fax NVARCHAR2(50),
Mobile NVARCHAR2(50) not null,
Email NVARCHAR2(50) not null,
Contactor_sex NUMBER(2),
Contactor NVARCHAR2(50),
Web_Site NVARCHAR2(200),
View_Count NUMBER(20,0),
Create_Date DATE not null,
Update_Date DATE not null,
Status NUMBER(2),
Company_Type NUMBER(2),
Remain_Point NUMBER(6,0),
Cmp_Level NVARCHAR2(50),
isAdv NUMBER(2),
Expri_Date DATE,
Display_index NUMBER(6,0),
constraint PK_COMPANY_INFO primary key (Company_ID)
);
我们如果加了某些字段,又要在原数据库上加上这些字段,我们可以这样:把create变为alter,然后将不要的
字段去除,如下所示:
代码如下:
alter table Company_Info add(
Remain_Point NUMBER(6,0),
Cmp_Level NVARCHAR2(50),
isAdv NUMBER(2),
Expri_Date DATE,
Display_index NUMBER(6,0)
)
这样就加快了我们的开发效率.