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. [NOIP2009]靶形数独 深搜+枝杈优化

    这道题,又是一位玄学搜索...... 我是用的蜗牛序搜的(顾名思义,@,这么搜),我正着搜80然后一反转比原来快了几十倍........一下AC....... 我的思路是这样的话我们可以从内到外或者从 ...

  2. 【BZOJ 2006】[NOI2010]超级钢琴 ST

    我们先把所有最左端对应的最优右端入堆,eg: z  在[l,r](由题目给出的L,R决定)之间的最优解 y,然后出堆以后,再入堆z,y-1,z,y+1,那么我们只需要用st找最大前缀和就好了(ST是一 ...

  3. 将一张表的主键(ID)重置为从1开始自增排列

    如果你有一张表,你的主键是ID,然后由于测来测去的原因,你的ID不是从1开始连续的自增了. 终于有一天,使用这张表的某个系统要导入正式数据了,强迫症这时候就表现的明显了,浑身不自在, 这时候你就需要将 ...

  4. [poj 3281]最大流+建图很巧妙

    题目链接:http://poj.org/problem?id=3281 看了kuangbin大佬的思路,还用着kuangbin板子orz   http://www.cnblogs.com/kuangb ...

  5. [poj 2342]简单树dp

    题目链接:http://poj.org/problem?id=2342 dp[i][0/1]表示以i为根的子树,选或不选根,所能得到的最大rating和. 显然 dp[i][0]=∑max(dp[so ...

  6. HDU 多校对抗赛 J Time Zone

    Time Zone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  7. WebOS系列-了解Wekbit【邓侃】

    注:[转载请注明文章来源.保持原样] 出处:http://www.cnblogs.com/jyli/archive/2010/02/02/1660634.html  作者:李嘉昱 这是Kan老大的We ...

  8. HTTP中的URL长度限制

    首先,其实http 1.1 协议中对url的长度是不受限制的,协议原文: The HTTP protocol does not place any a priori limit on the leng ...

  9. PHP文件操作函数二

    PHP部分文件访问函数总结: 1.filetype("文件路径")  //可以输出相关文件类型,返回之为:dir/file... 2.stat("文件名") / ...

  10. 膨胀、腐蚀、开、闭(matlab实现)

    膨胀.腐蚀.开.闭运算是数学形态学最基本的变换. 本文主要针对二值图像的形态学 膨胀:把二值图像各1像素连接成分的边界扩大一层(填充边缘或0像素内部的孔): B=[0 1 0      1 1 1   ...