修改数据库字段类型,但是由于数据表已经存在数据,无法修改;

显示错误:

 写道
ORA-01439: column to be modified must be empty to change datatype

修改方法:

    1. alter table web_app_base add tmp_col varchar2(3999);-- 添加临时列
    2. update web_app_base set tmp_col = C_EDR_CTNT ; --将目标字段中数据加入到临时列中
    3. update web_app_base set C_EDR_CTNT = null; --将目标字段数据清空
    4. alter table web_app_base modify (C_EDR_CTNT long); --更改目标字段类型
    5. update web_app_base set C_EDR_CTNT = tmp_col; --将临时列数据加回到目标字段中
    6. alter table web_app_base drop column tmp_col; --清除临时列

ORA-01439: column to be modified must be empty to change datatype的更多相关文章

  1. ORA-01440: column to be modified must be empty to decrease precision or scale

    在修改表字段的NUMBER类型的精度或刻度时,你可能会遇到ORA-01440: column to be modified must be empty to decrease precision or ...

  2. Oracle中表列由VARCHAR2类型改成CLOB

    情景 原来表中的列定义成VARCHAR2类型,众所周知,VARCHAR2类型最大支持长度为4000.假设因为业务须要.想把此列转换为CLOB类型,在Oracle中直接通过ALTER语句转换是行不通的. ...

  3. Oracle对列的操作总结

    1.更改列名 alter table TABLE_NAME rename column COLUMN_OLD COLUMN_NEW; 2.添加列 alter table TABLE_NAME add ...

  4. Oracle中字段的修改操作语法

      对字段操作 操作方法 更新字段名 alter table TABLE_NAME rename column column_old to column_new; 添加字段 alter table T ...

  5. oracle数据库中修改已存在数据的字段

    在oracle中,如果已经存在的数据的某些列,假如要更换类型的话,有的时候是比较麻烦的, 会出现:ORA-01439: column to be modified must be empty to c ...

  6. Oracle 如何修改列的数据类型

    链接:http://www.cnblogs.com/david-zhang-index/archive/2012/04/10/2441015.html 对字段操作 操作方法 更新字段名 alter t ...

  7. oracle修改已存在数据的字段类型

    第一次使用oracle数据库,在通过Navicat premium工具修改字段类型时,发现报“ORA-01439: column to be modified must be empty to cha ...

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

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

  9. Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.

      1: /// <summary> 2: /// Write an algorithm such that if an element in an MxN matrix is 0, it ...

随机推荐

  1. HackerRank "Kruskal (MST): Really Special Subtree"

    Kruskal Algorithm is based on Union-Find - quite intuitive. #include <vector> #include <ios ...

  2. 【1】第一次电话面试---上海EMC

    时间是2016//11月,投的是上海的EMC2公司的JavaWeb开发岗,第一次接到的电话面试,问的题目很基础基础,很遗憾,本人在掌握的太不好,回答的很乱,目测定挂.下面记下HR问的问题及回答. 首先 ...

  3. js传递参数中包含+号时的处理方法

    encodeURI(url).replace(/\+/g, '%2B') 例子: $scope.getAnesthesiawaystatistical = function (annual, anes ...

  4. webpack +vue开发(3)

    webpack的一些有用的命令 webpack --display-modules 在终端显示这些module,另外一个推荐使用 webpack --display-modules --display ...

  5. case语句

    case语句是多分支选择语句,if语句只有两个分支可供选择,而实际问题中常常需要用到多分支选择结构.例如,学生成绩分类(90分以上为A,--):人口统计分类(按年龄分为老.中.青.少.幼)等.当然这些 ...

  6. MySQL-(Master-Slave)配置

    1.两台机器,安装好版本一致的MySQL 192.168.29.128 (master) MySQL-5.6.21 192.168.29.129 (slave) MySQL-5.6.21 2.配置ma ...

  7. 58. N-Queens && N-Queens II

    N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no tw ...

  8. 安卓:drawable

    <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http: ...

  9. Statement及PreparedStatement执行多个sql

        这两个对象的区别: 1.Statement它更适合执行不同sql的批处理,它没有提供预处理功能,性能比较低. 2.PreparedStatement它适合执行相同的批处理,它提供了预处理功能, ...

  10. html doctype 作用介绍

    文档模式主要有以下两个作用: 1.告诉浏览器使用什么样的html或xhtml规范来解析html文档 2.对浏览器的渲染模式产生影响:不同的渲染模式会影响到浏览器对于 CSS 代码甚至 JavaScri ...