-- 移除索引
drop index TB_1;
drop index TB_2 ;
alter table TB drop constraint PK_TB;

--允许列为空

alter table TB modify (LN_NO CHAR(16) NULL);
alter table TB modify (IVS_NO CHAR(16) NULL);

--创建自增序列
create sequence SEQ_REC_ID
minvalue 1
maxvalue 999999999
start with 1
increment by 1
nocache;

--增加ID列
--alter table TB drop column ID;
alter table TB add (ID INT NULL);
UPDATE TB SET ID=SEQ_REC_ID.NEXTVAL;
alter table TB MODIFY (ID INT NOT NULL);

--创建主键
alter table TB
add constraint PK_TB primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);

Oracle增加自增长列的更多相关文章

  1. Oracle 给已创建的表增加自增长列

    对于已经创建的表,在特殊需求下,需要增加一个自增长列步骤: --1. 增加 自增长列 ); --2. 程序方式更新设置 IdNum 列 值 --3.查询最大 ) From Limsbusinessen ...

  2. silverlight 4中datagrid列标题和列内容居中问题,增加自增长列

    转载:http://www.cnblogs.com/guoyuanwei/archive/2011/01/02/1924163.html 命名空间:xmlns:Primitives="clr ...

  3. Oracle创建自动增长列

    前言: Oracle中不像SQL Server在创建表的时候使用identity(1001,1)来创建自动增长列,而是需要结合序列(Sequences)和触发器(Triggers)来实现 创建测试表 ...

  4. Oracle 增加 修改 删除 列

    语法结构如下: alter table tablename add (column datatype [default value][null/not null],….); alter table t ...

  5. Oracle数据库自动增长列的实现过程

    1.创建序列 -- Create sequence create sequence INNERID minvalue 1 maxvalue 99999999999999 start with 1 in ...

  6. 用触发器来实现Oracle的自增长列

    1, 添加id列 -- ############################################### -- add ID column for XXXXXXTABLE -- #### ...

  7. oracle创建自增长列

    --创建一个新表 /*create table students(stu_id number,stu_name varchar2(20),stu_email varchar2(40),primary ...

  8. Oracle增加一列、修改一列数据类型

    Oracle增加一列.修改一列数据类型: 添加一列: alter   table   A   add( CFYJSNR  varchar2(20)); 修改列: alter  table A  ren ...

  9. SQL Server 2012 自动增长列,值跳跃问题(自增增加1000)

    介绍 从 SQL Server 2012 版本开始, 当SQL Server 实例重启之后,表格的自动增长列的值会发生跳跃,而具体的跳跃值的大小是根据增长列的数据类型而定的.如果数据类型是 整型(in ...

随机推荐

  1. GNU project C

    gcc - GNU project C and C++ compiler   gcc [option] file...            preprocessing         compila ...

  2. Unity NGUI 3.0.4版本 制作网络版斗地主

    Unity NGUI 3.0.4版本 @by 灰太龙  开发环境 Win7旗舰版 Unity 4.2.1f4 本文就写个开门篇,告诉大家怎么用NGUI,第一步导入NGUI 3.0.4版本! 1.启动U ...

  3. PlatformTransactionManager

    Spring Boot 使用事务非常简单,首先使用注解 @EnableTransactionManagement 开启事务支持后,然后在访问数据库的Service方法上添加注解 @Transactio ...

  4. myisam和innodb索引实现的不同

    1.MyISAM 使用B+Tree 作为索引结构,叶子节点的data存放指针,也就是记录的地址.对于主键索引和辅助索引都是一样的.2.InnoDB 也使用B+Tree作为索引结构,也别需要注意的是,对 ...

  5. Codeforces 716A Crazy Computer 【模拟】 (Codeforces Round #372 (Div. 2))

    A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. 【模拟】Codeforces 691B s-palindrome

    题目链接: http://codeforces.com/problemset/problem/691/B 题目大意: 求一个字符串是不是镜像的(不是回文).是输出TAK否则RE. 题目思路: [模拟] ...

  7. HDOJ 2802 F(N)

    Problem Description Giving the N, can you tell me the answer of F(N)? Input Each test case contains ...

  8. [Locked] Graph Valid Tree

    Graph Valid Tree Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is ...

  9. 《Mathematical Olympiad——组合数学》——染色问题

    恢复  继续关于<Mathematical Olympiad——组合数学>中问题的分析,这一篇文章将介绍有关染色的问题. 问题一: 将一些石头放入10行14列的矩形方格表内,允许在每个单元 ...

  10. HTML参考手册

    New : HTML5 中的新标签. 标签 描述 <!--...--> 定义注释. <!DOCTYPE>  定义文档类型. <a> 定义锚. <abbr> ...