Ora error code 12899

Getting ORA-12899 while inserting into a table, or updating existing data in the table. Data length is bigger than column.

You may want to learn about a similar error message ORA-01438 caused by larger values being inserted in NUMBER columns. 
Message displayed with error ORA-12899 is self-explained.
This error would come if you are trying to insert into a table’s column which
is not big enough to hold the data being inserted. Suppose you define a column
with a width of 10 characters (VARCHAR2(10)), and later if you try to insert a
value longer than 10 characters, ORA-12899 would be returned. To solve this problem
you can either reduce the data width being inserted, or alternatively increase
the column width. If you have a multi-byte database characterset,
 a VARCHAR2 column with a width of 10 may not
store exactly 10 characters. Following is one example to produce ORA-12899.

SQL>
drop table test;

Table
dropped.

SQL>
create table test(name varchar2(4));

Table
created.

SQL>
insert into test values (‘aaaaaaaaa’);

insert
into test values (‘aaaaaaaaa’)

                         *

ERROR
at line 1:

ORA-12899:
value too large for column «SYS».»TEST».»NAME»
(actual: 9, maximum:4

SQL>
insert into test values (‘aaaa’);

1
row created.

Ezoic

Popular Posts — All Times

  • This error means that you are trying to perform some operation in the database which requires encryption wallet to be open, but wallet is …

  • Finding space usage of tablespaces and database is what many DBAs want to find. In this article I will explain how to find out space usage …

  • ORA-01653: unable to extend table <SCHEMA_NAME>.<SEGMENT_NAME> by 8192 in tablespace <TABLESPACE_NAME> This error is q…

  • You may also want to see this article about the ORA-12899 which is returned if a value larger than column’s width is inserted in the col…

  • This document explains how to start and stop an Oracle cluster. To start and stop Grid Infrastructure services for a standalone insta…

  • If you want to know how we upgrade an 11g database to 12c using DBUA,   click here .  For upgrading 12.1.0.1 to 12.1.0.2 using DBUA,   …

  • If database server CPU usage is showing 100%, or high 90%, DBA needs to find out which session is hogging the CPU(s) and take appropriate …

  • By default AWR snapshot interval is set to 60 minutes and retention of snapshots is set to 8 days. For better and precise investigation of…

  • SWAP space recommendation from Oracle corp. for Oracle 11g Release 2 If RAM is between 1 GB and 2 GB, SAWP should be 1.5 times the s…

  • This article explains how to install a 2 nodes Oracle 12cR1 Real Application Cluster (RAC) on Oracle Linux 7. I did this installation on O…

Problem

ORA-12899 Value of STATE too large for column while creating order, value too large for column

Symptom

When creating an order if one adds special characters to a CHAR
field, the length of which is equal to the column size, they see the following
error. This will be true while inserting special character values into any
column of type CHAR in the database, which is equivalent to the length of the
field.

Error Message

ErrorDescription=»ORA-12899: value too large for column «YANTRA_ADM».»YFS_PERSON_INFO».»STATE» (actual: 39, maximum: 35)
»

Resolving The Problem

Check the
NLS_LENGTH_SEMANTICS parameter from the NLS_INSTANCE_PARAMETERS table. Changing
the value to CHAR will resolve the issue.

alter session set
nls_length_semantics = CHAR, prior to running any create table
scripts.

Setting this attribute ensures that the
field sizes are not impacted by the number of bytes a data type can store. For
example, VARCHAR (40) would now be able to store 40 Japanese characters instead
of 40/3 bytes in the UTF-8 character set.

For an existing
table:

(1) Take backup of
the table if need be. (One can use exp utility)

(2) Drop the table

(3) Change the NLS_LENGTH_SEMANTICS
parameter to CHAR

(4)
Recreate the table.

To prove that a change in the length
semantics parameter will help, try the following steps in a local DB
schema:

(1) Make sure that
the NLS_LENGTH_SEMANTICS is set to BYTE.

(2) Create a dummy table with one column as CHAR
(30).

(3) Try inserting
data with special characters which is 30 in length

(4) This insertion should fail

(5) Issue the alter system command to
set the NLS_LENGTH_SEMANTICS parameter to CHAR.

(6) Drop the table and recreate
it.

(7) Try the same
insertion of data as in step 3.

This should be a good enough
proof to show that one can resolve the problem by dropping the table and
recreating it after modifying the parameter value of
NLS_LENGTH_SEMANTICS.

[{«Product»:{«code»:»SS6QYM»,»label»:»Sterling Selling and Fulfillment Suite»},»Business Unit»:{«code»:»BU055″,»label»:»Cognitive Applications»},»Component»:»Not Applicable»,»Platform»:[{«code»:»PF025″,»label»:»Platform Independent»}],»Version»:»All»,»Edition»:»»,»Line of Business»:{«code»:»LOB59″,»label»:»Sustainability Software»}}]

Historical Number

NFX5666

Product Synonym

[<p><b>]Type[</b><p>];NormalFix

November 5, 2020

When you start an import operation, you can get ” ORA-12899: value too large for column, KUP-11007: conversion error loading table ” errors.

ORA-12899: Value too Large for Column

KUP-11007: conversion error loading table

Error details are as follows.

KUP-11007: conversion error loading table "MSDBA"."TEST_TABLE"
ORA-12899: value too large for column ACCOUNT_ID (actual: 31, maximum: 29)
KUP-11009: data for row: ACCOUNT_ID : 0X'3238363032353338C7DD465445484132303130303530313135'


KUP-11007: conversion error loading table "MSDBA"."TEST_TABLE"
ORA-12899: value too large for column ACCOUNT_ID (actual: 31, maximum: 29)
KUP-11009: data for row: ACCOUNT_ID : 0X'3238363032353336C7454CDD4B434132303130303531323135'


KUP-11007: conversion error loading table "MSDBA"."TEST_TABLE"
ORA-12899: value too large for column ACCOUNT_ID (actual: 30, maximum: 29)
KUP-11009: data for row: ACCOUNT_ID : 0X'3238363032353334534F46554FD04C32303039313230373136'

KUP-11009: data for row

This error ORA-12899: value too large for column, KUP-11007: conversion error loading table is related with the Character set problem between source ( WE8ISO8859P9 ) and target ( AL32UTF8 ) .

Find Character Set of Oracle

You can check character set of oracle database with following scripts.

SQL> select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

PARAMETER VALUE
------------------------------ ----------------------------------------
NLS_CHARACTERSET WE8ISO8859P9

There are two solutions for these errors.

First solution is very easy. Alter the related column size and increase the column size as follows.

Alter Table Modify Column in Oracle

Column size was 30 byte in target, I will increase it to 36 as follows.

 alter table MSDBA.TEST_TABLE modify ACCOUNT_ID VARCHAR2(36 Byte);
TABLE_EXISTS_ACTION=TRUNCATE

Then start the import again with TABLE_EXISTS_ACTION=TRUNCATE, if you start it with replace or skip option, you will get the same error again. So start the impdp with TABLE_EXISTS_ACTION=TRUNCATE option as follows.

impdp "/ as sysdba" directory=VIN dumpfile=Part1_Prime%U.dmp TABLE_EXISTS_ACTION=truncate REMAP_TABLESPACE=TBS_DATA:TBS_MSD logfile=Part1_Prime_imp.log parallel=96 remap_schema=ACCOUNT:MSDBA TABLES=MSDBA.TEST_TABLE

The second sohutdown


sql> startup restriclution is very difficult, because to solve it you need to change the character set of target. But mostly it is not possible in Production databases. But if you are working on Test,Development, Bugfix database, then you may change it as follows to solve this error.

sql> st;

sql> ALTER DATABASE CHARACTER SET INTERNAL_USE WE8ISO8859P9 ;

sql> shutdown;

sql> startup;

You can read the following article, if you want to learn more details about Export – import.

Oracle Data Pump – Export Import ( Expdp Impdp ) Tutorial with Examples-4

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 3,389 views last month,  1 views today

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Вы видите разницу между символом и семантикой длины байта:

Вы должны указать максимальную длину для столбца VARCHAR2. Этот максимум должен быть не менее 1 байт, хотя фактической сохраненной строке разрешено быть строкой нулевой длины (”). Вы можете использовать квалификатор CHAR, например VARCHAR2 (10 CHAR), чтобы указать максимальную длину в символах вместо байтов. Символ является технически кодовой точкой набора символов базы данных. Вы можете использовать квалификатор BYTE, например VARCHAR2 (10 BYTE), чтобы явно указать максимальную длину в байтах. Если явный классификатор не включен в определение столбца или атрибута при создании объекта базы данных с этим столбцом или атрибутом, то семантика длины определяется значением параметра NLS_LENGTH_SEMANTICS сеанса, создающего объект.

Если ваш сеанс использует семантику байтов, столбец в вашей таблице будет по умолчанию:

select value from nls_session_parameters where parameter = 'NLS_LENGTH_SEMANTICS';

VALUE                                  
----------------------------------------
BYTE                                    

create table t42(text varchar2(5));

Table T42 created.

select char_used from user_tab_columns where table_name = 'T42' and column_name = 'TEXT';

C
-
B

То же самое, что и явное:

create table t42(text varchar2(5 byte));

Если ваши исходные данные составляют пять символов, но содержат любые многобайтовые символы, количество байтов будет превышать пять:

insert into t42 (text) values ('Hello');

1 row inserted.

insert into t42 (text) values ('Señor');

SQL Error: ORA-12899: value too large for column "SCHEMA"."T42"."TEXT" (actual: 6, maximum: 5)

Это то, что вы видите. Когда вы вставляете значения из другой таблицы, вы фильтруете длину значений, но length() подсчитывает символы, а не байты. Существует функция lengthb(), которая подсчитывает байты. Если вы проверите длину байта 30-значного значения, которое вы выбрали, вы увидите, что оно фактически равно 31 байту, поэтому один из этих символов является многобайтным.

with t42 (text) as (
  select 'Hello' from dual
  union all select 'Señor' from dual
  union all select 'Testing  - HLC/TC Design Corre' from dual
)
select text, length(text) as chars, lengthb(text) as bytes, dump(text, 16) as hex
from t42;

TEXT                            CHARS BYTES HEX                                                                                                      
------------------------------- ----- ----- ----------------------------------------------------------------------------------------------------------
Hello                               5     5 Typ=1 Len=5: 48,65,6c,6c,6f                                                                               
Señor                               5     6 Typ=1 Len=6: 53,65,c3,b1,6f,72                                                                            
Testing  - HLC/TC Design Corre     30    31 Typ=1 Len=31: 54,65,73,74,69,6e,67,c2,a0,20,2d,20,48,4c,43,2f,54,43,20,44,65,73,69,67,6e,20,43,6f,72,72,65

Из значений dump() вы можете видеть, что после Testing (54,65,73,74,69,6e,67) и перед пробелом и тире (20,2d) у вас есть c2,a0, который многобайтовый неразрывный пробел UTF-8. (Вы часто видите, что вместе с фигурными кавычками и другими символами диапазона, отличными от ASCII, в тексте, который был скопирован, например, из документа Word).

Вы можете либо изменить свою вставку на фильтр на LENGTHB(column1)=30 (который исключает найденную вами строку), либо изменить определение столбца на 30 символов вместо 30 байтов:

drop table t42;

Table T42 dropped.

create table t42(text varchar2(5 char));

Table T42 created.

select char_used from user_tab_columns where table_name = 'T42' and column_name = 'TEXT';

C
-
C

insert into t42 (text) values ('Hello');

1 row inserted.

insert into t42 (text) values ('Señor');

1 row inserted.

Или заменить любые неожиданные многобайтовые символы однобайтными эквивалентами, если это возможно и имеет смысл для ваших данных; в этом случае нормальное пространство может работать, но с любой заменой вы уничтожаете информацию, которая может быть действительно важной.

ОР-12899

Часто, поскольку наши компании растут и развиваются в ответ на расширение в виде клиентской базы, персонала, прибыли или рынков, данные, связанные с этим ростом, также будут меняться. Системы данных, такие как У Oracle есть врожденная способность оставаться достаточно гибкой в ​​отношении работая с этим изменением информации. Тем не менее, даже самые универсальные системы баз данных требуют обслуживания и доработки в лицом повышенного трафика данных. Эта работа имеет важное значение для с учетом любых ограничений на память или необходимых переопределений параметры. Ошибка ORA-12899 является представителем экземпляра в который либо всплеск данных, либо ошибка пользователя заставляет Oracle в течение запрошенного действия.

ПРОБЛЕМА

ORA-12899 – это ошибка Oracle, которая возникает, когда введенное значение в строку столбца слишком велико. Это означает, что пользователь попытался обновить или вставить столбец со значением который слишком широк для столбца назначения. Название конкретного столбец и фактическая ширина значения, а также максимальная ширина, разрешенная для столбца, будет связана с этим. Как уже упоминалось, значение может быть задано в виде символов. в что ширина будет указана в символах, это будет означать, что семантика длины символа работает для столбца. В противном случае ширина будет сообщена в байтах. По сути, эта ошибка возникает из пытаясь проталкивать значение или набор значений, превышающих указанная максимальная ширина столбца. Итак, как пользователь исправляет этот тип ошибки?

РЕШЕНИЕ

Для начала откройте служебную программу OERR. Пользователь потребует полного ORA-12899 для получения правильной обратной связи по ошибке. Эта будет предоставлять дополнительную информацию об ошибке и расследование. Как правило, ошибка может исходить от одного из трех источники. Первым источником являются инструкции SQL, которые были генерироваться. Проверка типов данных столбцов источника и получателя на выясните, совместимы ли они с текущими форматами. второстепенный источник. Наконец, пользователь может посмотреть столбец назначения width – где значение присваивается – чтобы убедиться, что он большой достаточно для размещения максимального значения, которое пользователь ожидает назначения. Обратимся теперь к примеру, который исправляет ORA-12899. Предположим, что пользователь создал следующую таблицу:

CREATE TABLE Clients(
ClientID varchar2(9) PRIMARY KEY,
Client_Contact varchar2(40) NOT NULL,
Address varchar(20) NOT NULL,
Zip varchar2(5) NOT NULL,
Client_Number varchar2(11) NOT NULL)

Затем пользователь пытается выдать оператор INSERT VALUES, который выглядит что-то вроде этого:

INSERT INTO Clients VALUES(
727546345,
‘Roger Holcomb’,
‘—Benjamin Road Syracuse’,
‘-----‘, 05307623754)

Пользователь может попытаться запустить инструкцию здесь, но получит следующее сообщение об ошибке:

Ошибка, начиная с строки 7 в команде: INSERT INTO Клиенты ЦЕННОСТИ (727546345, “Рики Галорей”, 18 Бенджамин Роуд Сиракузы, ‘13208, 05307623754) Отчет об ошибке: Ошибка SQL: ORA-12899: значение тоже большой для столбца “ОРГАНИЗАЦИИ”. “РЫНОК”. “АДРЕС” (актуально: 25, максимум: 20) 12899. 00000 – значение слишком велико для столбца% s (фактическое: % s, максимум:% s) “

Этот оператор ошибки указывает, что переменная ‘Address не может содержать более двадцати символов, так как это превысит ширину столбца. Когда мы оглянемся на значение адреса (18 Бенджамин Road Syracuse), мы видим, что общее количество символов (25) превышает максимальное допустимое значение ширины столбца. к исправьте это, пользователь может изменить VARCHAR2 для адреса на количество, которое может соответствовать типичной длине адреса, компания будет вводить.

Вышеуказанный исходный URL-адрес ответа

Из-за разных параметров NLS в базе данных целевой таблицы может потребоваться больше байтов в целевом объекте.
Попробуйте изменить таблицу как   alter table1 изменить column1 varchar2 (30 char)

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Ora 03106 fatal two task communication protocol error
  • Oracle ora 12801 error signaled in parallel query server
  • Ora 02391 ошибка
  • Oracle oci error
  • Ora 02291 ошибка

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии