ORA-22835:缓冲区太小,无法从CLOB转换为CHAR或从BLOB转换为RAW(实际:4448,最大:4000)

时间:2018-12-14 02:18:20

标签: sql oracle stored-procedures

我正在尝试迁移客户端的数据,并且此错误在迁移过程中发生。我进行了搜索,可能的解决方案是修剪或使用DBMS_LOB.SUBSTR,但我不知道将它们放在哪里。可能是(TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval)的这一部分,但是我对SQL还是陌生的,不确定可能是问题的原因。谁能指导我如何解决这个问题?谢谢!

Update
       AIMSCMDDL_AT.AI_OPENNET_SVC_RPT
SET
       CUST_AGREEMENT_SIGNATURE = 
           CASE
                  WHEN TO_CHAR(CUST_AGREEMENT_SIGNATURE) = null
                        THEN null
                        ELSE 'NULL'
           END
     , CUST_DECLARATION_AUTH_ID = 
           CASE
                  WHEN CUST_DECLARATION_AUTH_ID = null
                        THEN null
                        ELSE 
                            CASE WHEN LENGTH(CUST_DECLARATION_AUTH_ID)<>9
                                THEN TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval)
                                ELSE 
                                    CASE WHEN LENGTH(CUST_DECLARATION_AUTH_ID)=9
                                                and REGEXP_LIKE(substr(CUST_DECLARATION_AUTH_ID,1,1),'[A-Za-z]') 
                                                and REGEXP_LIKE(substr(CUST_DECLARATION_AUTH_ID,-1,1), '[A-Za-z]') 
                                                and  AIMSCMDDL_AT.is_number(substr(CUST_DECLARATION_AUTH_ID,2,7)) = 1                                       
                                         THEN substr(CUST_DECLARATION_AUTH_ID,1,1)||LPAD(TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval),7,'0')||substr(CUST_DECLARATION_AUTH_ID,-1,1)
                                         ELSE TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval)
                                    END
                            END         
            END
     , CUST_DECLARATION_AUTH_NM = 
           CASE
                  WHEN CUST_DECLARATION_AUTH_NM = null
                        THEN null
                        ELSE REGEXP_REPLACE(CUST_DECLARATION_AUTH_NM,'[[:alpha:]^[:digit:]^[:punct:]^]','*')
           END
     , CUSTOMER_SIGNATURE = 
           CASE
                  WHEN TO_CHAR(CUSTOMER_SIGNATURE) = null
                        THEN null
                        ELSE 'NULL'
           END
     , INSTALLER_NM = 
           CASE
                  WHEN INSTALLER_NM = null
                        THEN null
                        ELSE REGEXP_REPLACE(INSTALLER_NM,'[[:alpha:]^[:digit:]^[:punct:]^]','*')
           END
     , INSTALLER_SIGNATURE = 
           CASE
                  WHEN TO_CHAR(INSTALLER_SIGNATURE) = null
                        THEN null
                        ELSE 'NULL'
           END
     , REJ_CUSTOMER_ID = 
           CASE
                  WHEN REJ_CUSTOMER_ID = null
                        THEN null
                        ELSE 
                            CASE WHEN LENGTH(REJ_CUSTOMER_ID)<>9
                                THEN TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval)
                                ELSE 
                                    CASE WHEN LENGTH(REJ_CUSTOMER_ID)=9
                                                and REGEXP_LIKE(substr(REJ_CUSTOMER_ID,1,1),'[A-Za-z]') 
                                                and REGEXP_LIKE(substr(REJ_CUSTOMER_ID,-1,1), '[A-Za-z]') 
                                                and  AIMSCMDDL_AT.is_number(substr(REJ_CUSTOMER_ID,2,7)) = 1                                        
                                         THEN substr(REJ_CUSTOMER_ID,1,1)||LPAD(TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval),7,'0')||substr(REJ_CUSTOMER_ID,-1,1)
                                         ELSE TO_CHAR(AIMSCMDDL_AT.BIOS_SEQ.nextval)
                                    END
                            END         
            END
     , REJ_CUSTOMER_NM = 
           CASE
                  WHEN REJ_CUSTOMER_NM = null
                        THEN null
                        ELSE REGEXP_REPLACE(REJ_CUSTOMER_NM,'[[:alpha:]^[:digit:]^[:punct:]^]','*')
           END
     , REJ_CUSTOMER_SIGNATURE = 
           CASE
                  WHEN TO_CHAR(REJ_CUSTOMER_SIGNATURE) = null
                        THEN null
                        ELSE 'NULL'
           END
     , REJ_INSTALLER_NM = 
           CASE
                  WHEN REJ_INSTALLER_NM = null
                        THEN null
                        ELSE REGEXP_REPLACE(REJ_INSTALLER_NM,'[[:alpha:]^[:digit:]^[:punct:]^]','*')
           END
     , REJ_INSTALLER_SIGNATURE = 
           CASE
                  WHEN TO_CHAR(REJ_INSTALLER_SIGNATURE) = null
                        THEN null
                        ELSE 'NULL'
           END             
         ;

1 个答案:

答案 0 :(得分:0)

最有可能来自以下表达式之一:

CASE
    WHEN TO_CHAR(INSTALLER_SIGNATURE) = null
    THEN null
    ELSE 'NULL'
END

首先,它们不起作用。 ... = NULL 从不产生TRUE。改为IS NULL。 无需使用TO_CHAR()IS NULL适用于任何数据类型。

您可以将其写为更短

INSTALLER_SIGNATURE = NVL2(INSTALLER_SIGNATURE, 'NULL', NULL)

NB,

REGEXP_LIKE(substr(CUST_DECLARATION_AUTH_ID,1,1),'[A-Za-z]') 
and REGEXP_LIKE(substr(CUST_DECLARATION_AUTH_ID,-1,1), '[A-Za-z]') 

可以写为

REGEXP_LIKE(CUST_DECLARATION_AUTH_ID,'^[A-Za-z].*[A-Za-z]$')