zoukankan      html  css  js  c++  java
  • 字符乱码 导致 ORA-12899: value too large

    问题场景:
    1.创建测试表
        create table t01(name varchar2(30))
    
    2.插入数据
        SQL> insert into t01 (name) values('所有分销商');  
        insert into t01 (name) values('所有分销商’)
                                      *
        ERROR at line 1:
        ORA-12899: value too large for column "DRP"."T01"."NAME" (actual: 63, maximum:
        30)
        SQL> 
        
    问题分析:
        猜测:可能是字符编码不一致,导致长度计算错误。
    
    确认环境编码
        1.终端CRT编码 UTF-8
        
        2.数据库编码 
        SQL> select userenv('language') from dual;
        USERENV('LANGUAGE')
        ---------------------------
        AMERICAN_AMERICA.AL32UTF8
        
        3.设置服务器变量 
        [oracle@Oracle02 ~]$ export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
    
    再次测试:
        SQL> insert into t01(name) values('中');
    
        1 row created.
    
        SQL> select * from t01;
    
        NAME
        ------------------------------
        中
    
        SQL> insert into t01 (name) values('所有分销商');
    
        1 row created.
    
        SQL>     
        
    结论:    NLS_LANG未设置导致字符编码不一致,导致长度计算错误。
  • 相关阅读:
    odoo10 入门
    git 命令详细介绍
    odoo中Python实现小写金额转换为大写金额
    {DARK CTF } OSINT/Eye
    2020 12 18
    2020 12 17
    2020 12 16
    2020 12 15
    2020 11 14
    2020 11 13
  • 原文地址:https://www.cnblogs.com/polestar/p/6652583.html
Copyright © 2011-2022 走看看