ORA-12899 相同列的字符串太大但不同表成功
ORA-12899 Error Too large String for Same column but success different tables
我正在将长度为 35 的列的字符串更新为两个 tables
第一个 table 更新成功但第二个 table 给出 ORA 错误 ORA-12899 错误太大字符串
select length('Andres Peñalver D1 Palmar Sani salt') bytes from dual;
BYTES
----------
35
select lengthb('Andres Peñalver D1 Palmar Sani salt') bytes from dual;
BYTES
----------
36
两个 tables colm1 字段都声明为 VARCHAR(35),第一个 table 更新失败,第二个更新成功。
update t
set colm1='Andres Peñalver D1 Palmar Sani Salt'
where value1='123456';
update t2
set colm1='Andres Peñalver D1 Palmar Sani Salt'
where value1='123456';
ORA-12899
select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
----------------------------------------------------------------
AL32UTF8
让我知道为什么这些 table 具有相同列类型
的行为
错误消息文档中描述的完整错误消息
应该会给你答案:
$ oerr ora 12899
12899, 00000, "value too large for column %s (actual: %s, maximum: %s)"
// *Cause: An attempt was made to insert or update a column with a value
// which is too wide for the width of the destination column.
// The name of the column is given, along with the actual width
// of the value, and the maximum allowed width of the column.
// Note that widths are reported in characters if character length
// semantics are in effect for the column, otherwise widths are
// reported in bytes.
// *Action: Examine the SQL statement for correctness. Check source
// and destination column data types.
// Either make the destination column wider, or use a subset
// of the source column (i.e. use substring).
这可能链接到 character length semantics。
检查 all_tab_columns 中 table 的实际列大小。
35 个字符是 35 个字节的 3 倍,如果一个 table 的列在字符中定义,另一个在字节中定义(在 ddl 期间),则大小不同。
像 A-Z a-z 这样的普通字符需要 1 个字节来存储,但语言特定字符需要 3 个字节来存储。
我正在将长度为 35 的列的字符串更新为两个 tables
第一个 table 更新成功但第二个 table 给出 ORA 错误 ORA-12899 错误太大字符串
select length('Andres Peñalver D1 Palmar Sani salt') bytes from dual;
BYTES
----------
35
select lengthb('Andres Peñalver D1 Palmar Sani salt') bytes from dual;
BYTES
----------
36
两个 tables colm1 字段都声明为 VARCHAR(35),第一个 table 更新失败,第二个更新成功。
update t
set colm1='Andres Peñalver D1 Palmar Sani Salt'
where value1='123456';
update t2
set colm1='Andres Peñalver D1 Palmar Sani Salt'
where value1='123456';
ORA-12899
select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
----------------------------------------------------------------
AL32UTF8
让我知道为什么这些 table 具有相同列类型
的行为错误消息文档中描述的完整错误消息 应该会给你答案:
$ oerr ora 12899
12899, 00000, "value too large for column %s (actual: %s, maximum: %s)"
// *Cause: An attempt was made to insert or update a column with a value
// which is too wide for the width of the destination column.
// The name of the column is given, along with the actual width
// of the value, and the maximum allowed width of the column.
// Note that widths are reported in characters if character length
// semantics are in effect for the column, otherwise widths are
// reported in bytes.
// *Action: Examine the SQL statement for correctness. Check source
// and destination column data types.
// Either make the destination column wider, or use a subset
// of the source column (i.e. use substring).
这可能链接到 character length semantics。
检查 all_tab_columns 中 table 的实际列大小。 35 个字符是 35 个字节的 3 倍,如果一个 table 的列在字符中定义,另一个在字节中定义(在 ddl 期间),则大小不同。 像 A-Z a-z 这样的普通字符需要 1 个字节来存储,但语言特定字符需要 3 个字节来存储。