http://www.dba-oracle.com/t_alter_table_modify_column_syntax_example.htm

For complete tips on Oracle alter table syntax, see the book "Easy Oracle Jumpstart".  Oracle provides "alter table" syntax to modify data columns in-place in this form:

alter table
   table_name
modify
   column_name  datatype;

If you are brave you can use a single "alter table" syntax to modify multiple columns:

alter table
   table_name
modify
   (
   column1_name  column1_datatype,
   column2_name  column2_datatype,
   column3_name  column3_datatype,
   column4_name  column4_datatype
   );

Here are some examples of Oracle "alter table" syntax to modify data columns and note that you can add constraints like NOT NULL:

ALTER TABLE 
   customer 
MODIFY 
   ( 
   cust_name varchar2(100) not null,
   cust_hair_color  varchar2(20)
   )
;

We can also use Oracle "alter table" syntax in dynamic PL/SQL to modify data columns

BEGIN 
SQL_STRING := 'ALTER TABLE '||:TABLE_NAME||' MODIFY '||:COLUMN_NAME||' VARCHAR2(100)';
 . . . 
END; 

Oracle alter table modify column Syntax example的更多相关文章

  1. [Hive - LanguageManual] Alter Table/Partition/Column

    Alter Table/Partition/Column Alter Table Rename Table Alter Table Properties Alter Table Comment Add ...

  2. oracle alter table

    oracle alter table ALTER TABLE (表名) ADD (列名 数据类型); ALTER TABLE (表名) MODIFY (列名 数据类型); ALTER TABLE (表 ...

  3. 【待整理】MySQL alter table modify vs alter table add产生state不一样

    MySQL:5.6.35 OS:redhat5.8 今天更新数据库某些表字段,有如下两SQL: ①alter table xx modify xxxx;(表大概是77w) ②alter table s ...

  4. faster alter table add column

    Create a new table (using the structure of the current table) with the new column(s) included. execu ...

  5. SQL SERVER删除列,报错."由于一个或多个对象访问此列,ALTER TABLE DROP COLUMN ... 失败"

    队友给我修改数据的语句.总是执行失败.很纳闷. 如下图: 仔细看了下这个列,并没有什么特殊.如下图: 但其确实有个约束: 'DF__HIS_DRUG___ALL_I__04E4BC85' . 为什么有 ...

  6. Modify column Vs change column

    引言 I know, we can not rename a column using modify column syntax,but can change column syntax. My qu ...

  7. Oracle Drop Table

    DROP TABLE 使用DROP TABLE语句将表或对象表移动到回收站或从数据库中完全删除表及其所有数据. 注:除非指定purge子句,否则drop table语句不会将表占用的空间释放回表空间供 ...

  8. MySQL ALTER TABLE: ALTER vs CHANGE vs MODIFY COLUMN

    ALTER COLUMN 语法: ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT} 作用: 设置或删除列的默认值.该操作会直接修 ...

  9. alter table fx.pet modify column `species` varchar(20) binary;

    alter table fx.pet modify column `species` varchar(20) binary;

随机推荐

  1. [Leetcode] count and say 计数和说

    The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...

  2. [Leetcode] spiral matrix ii 螺旋矩阵

    Given an integer n, generate a square matrix filled with elements from 1 to n 2 in spiral order. For ...

  3. AOJ.559 丢失的数字

    丢失的数字 Time Limit: 1000 ms Memory Limit: 64 MB Total Submission: 1552 Submission Accepted: 273 Descri ...

  4. 【POJ 3169 Layout】

    Time Limit: 1000MSMemory Limit: 65536K Total Submissions: 12565Accepted: 6043 Description Like every ...

  5. malloc calloc realloc

    三个函数的申明分别是: void* realloc(void* ptr, unsigned newsize); void* malloc(unsigned size); void* calloc(si ...

  6. php模板引擎smarty

    一. smarty的特点 速度:相对于其他模板引擎,速度较快 编译型:在下次访问模板时直接访问编译文件,不再进行模板重新编译 缓存技术:可以将用户最终看到的HTML文件缓存成一个静态HTML 插件技术 ...

  7. API教程

    www.yuanjiaocheng.net http://www.yuanjiaocheng.net/webapi/test-webapi.html

  8. [51nod1009]数字1的数量

    解题关键:数位dp,对每一位进行考虑,通过过程得出每一位上1出现的次数 1位数的情况: 在解法二中已经分析过,大于等于1的时候,有1个,小于1就没有. 2位数的情况: N=13,个位数出现的1的次数为 ...

  9. 在DirectX11下用Stencil Buffer绘制可视化Depth Complexity

    这是一道在<Introduction to 3D Game Programming with DirectX 11>上的练习题. 要求把某个像素点上的Depth Complexity(深度 ...

  10. 最近研究xcodebuild批量打包的一些心得

    http://blog.csdn.net/tlb203/article/details/8131707 转自Rainbird的个人博客 以前的时候只知道做安卓开发的兄弟挺辛苦的,不但开发的时候要适配一 ...