Friday 10 July 2015

ORA-01438 Which Column

ORA-01438: value larger than specified precision allowed for this column


You will receive this error while trying to insert big Value In Column with Specific Range , But How Could You know Which Column is it i will some hint that could help you to do that :

Hint #1 :

1-ORA-01438  : For Numeric Value
2-ORA-12899  : For Varchar2 Value

Hint #2 :

Enable Audit On know which One of these Column caused the error

    SQL > Create table test as select * from scott.dept

    SQL> desc dept
     Name                                Null?    Type
     ----------------------------------- -------- ------------------------
     DEPTNO                              NOT NULL NUMBER(2)
     DNAME                                        VARCHAR2(14)
     LOC                                          VARCHAR2(13)
    
    SQL> audit insert on test.test whenever not successful;
    
    Audit succeeded.
    
    SQL> insert into test.test values(2000,'test','test');
    insert into scott.dept values(2000,'test','test')
                                  *
    ERROR at line 1:
    ORA-01438: value larger than specified precision allowed for this
    column
    
    
    SQL> select sql_text,returncode from dba_audit_trail
      2  where owner='test' and obj_name='TEST';
    
    SQL_TEXT
    ----------------------------------------------------------------------
    RETURNCODE
    ----------
    insert into scott.dept values(2000,'test','test')
          1438

 Hint #3 :

Enable Tracing Level 1438


SQL > conn test/test ;
SQL> create table test as select * from scott.dept ;

SQL> select * from test ;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON


SQL> alter system set events='1438 trace name Errorstack forever,level 10';


SQL> insert into test values (100000000000000000,'test','JOR');                        
insert into test values (100000000000000000,'test','JOR')
                         *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

In Trace File :

ORA-01438: value larger than specified precision allowed for this column
Current SQL statement for this session:
insert into test values (100000000000000000,'test','JOR')

Thanks.
NJ

No comments:

Post a Comment