【问题标题】:how to add columns with 5000 length in oracle如何在oracle中添加长度为5000的列
【发布时间】:2013-03-07 07:07:11
【问题描述】:

我想要一个 oracle 中的表,其中包含 5 列,每列长度为 5000。
我正在使用 varchar(5000) 但它不允许。

Error starting at line 8 in command:
ALTER TABLE WORK_STATIC_DATA_AUDIT 
MODIFY ("NEW_VALUE" VARCHAR2(5000))
Error report:
SQL Error: ORA-00910: specified length too long for its datatype
00910. 00000 -  "specified length too long for its datatype"
*Cause:    for datatypes CHAR and RAW, the length specified was > 2000;
           otherwise, the length specified was > 4000.
*Action:   use a shorter length or switch to a datatype permitting a
           longer length such as a VARCHAR2, LONG CHAR, or LONG RAW 

我尝试了 CLOBLONG,但它是说我们每张桌子只能有一个 CLOB 或 Long 的 cloumn。
请帮帮我..

【问题讨论】:

    标签: sql oracle database-administration


    【解决方案1】:

    我刚刚使用以下 DDL 创建并测试了表:

    create table x (x clob,z clob,c clob,a clob, y long)
    

    试试看。

    可能有帮助...2 列 long 被拒绝。

    您还可以使用一种解决方法,即创建 5 个具有 1 个 id 列和 1 个长列的表,然后通过 ID 与您的主表连接。路很长,但有效

    【讨论】:

    • 您使用的查询是什么..??你不能对长数据类型使用like子句...
    【解决方案2】:

    VARCHAR2 的限制是 4000 CHAR,因此您必须对长度为 4000 或更长的列使用 CLOB。正如您所指出的,每个表的 LONG 列数是 1,但每个表可以有多达 1000 个 CLOB(1000 是 any 表的 最大 列数)。

    使用 CLOB 应该可以实现 5 列,每列长度为 4000 或更多(如 5000)。

    见:Oracle Datatype Limits

    【讨论】:

      猜你喜欢
      • 2018-09-27
      • 2019-10-08
      • 1970-01-01
      • 1970-01-01
      • 2020-04-10
      • 2011-03-22
      • 2022-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多