2017-10-04 184 views
1

我跑我的ColdFusion 2016應用程序時,得到了以下錯誤: 錯誤說:ORA-06502:PL/SQL:數字或值錯誤:字符串緩衝區

[Macromedia][Oracle JDBC Driver][Oracle]ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "PROC_CHECKDATA", line 1064 ORA-06512: at line 1

這是有事情做與調用一個存儲過程並運行它。當我在ColdFusion 8中運行它時,這些代碼工作了很多年,但一旦我轉移到ColdFusion 2016,它就會出錯。我不太明白這個錯誤說的是什麼。我感謝任何幫助,我可以得到。非常感謝。

這裏是我的過程調用:

<cfstoredproc procedure="PROC_CHECKDATA" datasource="#application.DSN#">    
    <cfprocparam type="in" cfsqltype="CF_SQL_CHAR" DBVARNAME="ins" value="#url.ins#" MAXLENGTH="2">   
    <cfprocparam type="in" cfsqltype="CF_SQL_CHAR" DBVARNAME="ly" value="#url.ly#" MAXLENGTH="4">   
    <cfprocparam type="inout" cfsqltype="CF_SQL_VARCHAR" DBVARNAME="summary" variable="summary" value="">   
    <cfprocparam type="inout" cfsqltype="CF_SQL_VARCHAR" DBVARNAME="continue" variable="continue" value=""> 

    <cfprocresult name="errors" resultset="1"> 
</cfstoredproc> 

這是存儲過程(在Oracle 11g中):

create or replace PROCEDURE proc_checkparentdata (
    v_institution IN  CHAR DEFAULT NULL, 
    v_load_year IN  CHAR DEFAULT NULL, 
    v_summary  OUT VARCHAR2, /* DEFAULT ' '*/        
    v_continue  OUT VARCHAR2, /* DEFAULT ' '*/        
    cv_1    OUT SYS_REFCURSOR) 
    AS 
    v_rowcount NUMBER (10, 0); 
     v_errorcount NUMBER (5, 0); 
    BEGIN 
    -- clear comment 
    UPDATE um_parent_temp 
    SET comments = ' ' 
    WHERE load_year = v_load_year AND institution = v_institution; 

    -- clear status 
    UPDATE um_parent_temp 
    SET status = ' ' 
    WHERE load_year = v_load_year AND institution = v_institution; 

    -- campus code 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Campus code: ' 
     || institution 
    WHERE institution NOT IN ('BC', 'CP', 'ES', 'FS', 'SU', 'TU', 'UC') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    /* parent 1 */ 
    -- firstname 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent firstname1 is missing' 
    WHERE NVL (trim(parent_fn1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- lastname 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent_lastname1 is missing' 
    WHERE NVL (trim(parent_ln1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- lastname1 too short 
    UPDATE um_parent_temp 
    SET comments = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent_lastname1 is too short' 
    WHERE Length(trim(parent_ln1)) = 1 
    AND load_year = v_load_year 
    AND institution = v_institution;  

    -- maximum label name = 60; includes three spaces 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent mailname1 is over 60 characters' 
    WHERE lengthc (nvl(trim(parent_prefix1),'') || 
    nvl(trim(parent_fn1),'') || nvl(trim(parent_mn1),'') || 
    nvl(trim(parent_ln1),'')) > 37 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- prefix 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Prefix1: ' 
     || parent_prefix1 
    WHERE NVL (trim(parent_prefix1), ' ') = ' ' 
    OR (NVL (trim(parent_prefix1), ' ') <> ' ' 
    AND parent_prefix1 NOT IN 
     (SELECT gl_prefixes.campprefix FROM gl_prefixes) 
    AND load_year = v_load_year 
    AND institution = v_institution); 

    -- suffixPers 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Personal suffix1: ' 
     || parent_suffix_pers1 
    WHERE NVL (trim(parent_suffix_pers1), ' ') <> ' ' 
    AND parent_suffix_pers1 NOT IN 
     (SELECT gl_suffixes.campsuffix FROM gl_suffixes) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- suffixProf 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Profession suffix1: ' 
     || parent_suffix_prof1 
    WHERE NVL (trim(parent_suffix_prof1), ' ') <> ' ' 
    AND parent_suffix_prof1 NOT IN 
     (SELECT gl_suffixes.campsuffix FROM gl_suffixes) 
     AND load_year = v_load_year 
     AND institution = v_institution; 

    -- race 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Race1: ' 
     || race1 
    WHERE NVL (trim(race1), ' ') <> ' ' 
    AND race1 NOT IN (SELECT campcode 
        FROM gl_races 
        WHERE campuscode = v_institution) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- sex 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Sex code1: ' 
     || sex1 
    WHERE NVL (trim(sex1), ' ') NOT IN ('M', 'F') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Mismatching gender1 and prefix1: ' 
     || parent_prefix1 
     || ' <---> ' 
     || sex1 
    WHERE ((sex1 = 'M' 
    AND trim(parent_prefix1) IN ('Mrs.', 'Mrs', 'Miss.', 'Miss', 'Ms.', 
                   'Ms')) 
    OR (trim(sex1) = 'F' AND trim(parent_prefix1) IN ('Mr.', 'Mr'))) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- address 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Preferred address flag1: ' 
     || pref_addr1 
     || '<br>' 
     || 'note: must also have unlisted flag set for preferred addr' 
    WHERE trim(pref_addr1) NOT IN ('H', 'B') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home address1_1 is empty' 
    WHERE pref_addr1 = 'H' 
    AND NVL (trim(home_addr1_1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Business address1 is empty' 
    WHERE pref_addr1 = 'B' 
    AND NVL (trim(busn_addr1_1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- city 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home city1 is empty' 
    WHERE NVL (trim(home_addr1_1), ' ') <> ' ' 
    AND NVL (trim(home_city1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Business city1 is empty' 
    WHERE NVL (trim(busn_addr1_1), ' ') <> ' ' 
    AND NVL (trim(busn_city1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- state 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home state code1: ' 
     || home_state1 
    WHERE NVL (trim(home_addr1_1), ' ') <> ' ' 
    AND trim(home_country1) IN ('US', 'USA', ' ') 
    AND trim(home_state1) NOT IN (SELECT tms_states.state_code FROM 
    tms_states) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Business state code1: ' 
     || busn_state1 
    WHERE NVL (trim(busn_addr1_1), ' ') <> ' ' 
    AND trim (busn_country1) IN ('US', 'USA', ' ') 
    AND busn_state1 NOT IN (SELECT tms_states.state_code FROM tms_states) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- zip 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Invalid home zip code1: ' 
     || home_zip1 
    WHERE trim(home_country1) IN ('US', 'USA', ' ') 
    AND INSTR (home_zip1, '-') > 0 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Invalid business zip code1: ' 
     || busn_zip1 
    WHERE trim (busn_country1) IN ('US', 'USA', ' ') 
    AND INSTR (busn_zip1, '-') > 0 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- country 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home country code1: ' 
     || home_country1 
    WHERE NVL (trim(home_country1), ' ') <> ' ' 
    AND NVL (trim(home_country1), ' ') NOT IN (select campcountry from  
    gl_countries 
    WHERE gradloadcode = v_institution) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Business country code1: ' 
     || busn_country1 
    WHERE NVL (trim(busn_country1), ' ') <> ' ' 
    AND busn_country1 NOT IN (select campcountry from gl_countries 
          WHERE gradloadcode = v_institution) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- unlisted flag 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Invalid home unlisted flag 1' 
    WHERE pref_addr1 = 'H' 
    AND home_unlisted_flag1 NOT IN ('N', 'Y') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Invalid business unlisted flag 1' 
    WHERE pref_addr1 = 'B' 
    AND busn_unlisted_flag1 NOT IN ('N', 'Y') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    /* parent 2 */ 
    -- firstname 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent firstname2 is missing' 
    WHERE NVL (trim(parent_fn2), ' ') = ' ' 
    AND NVL (trim(parent_ln2), ' ') <> ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- lastname 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent lastname2 is missing' 
    WHERE NVL (trim(parent_ln2), ' ') = ' ' 
    AND NVL (trim(parent_fn2), ' ') <> ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- lastname2 too short 
    UPDATE um_parent_temp 
    SET comments = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent_lastname2 is too short' 
    WHERE Length(trim(parent_ln2)) = 1 
    AND NVL (trim(parent_fn2), ' ') <> ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution;  

    -- maximum label name = 460; includes three spaces 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Parent mailname2 is over 60 characters' 
    WHERE NVL (trim(parent_fn2), ' ') <> ' ' 
    AND lengthc (parent_prefix2 || parent_fn2 || parent_mn2 || 
    parent_ln2) > 57 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- prefix 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Prefix2: ' 
     || parent_prefix2 
    WHERE NVL (trim(parent_prefix2), ' ') <> ' ' 
    AND parent_prefix2 NOT IN 
     (SELECT gl_prefixes.campprefix FROM gl_prefixes) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- suffixPers 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Personal suffix2: ' 
     || parent_suffix_pers2 
    WHERE NVL (trim(parent_suffix_pers2), ' ') <> ' ' 
    AND parent_suffix_pers2 NOT IN 
     (SELECT gl_suffixes.campsuffix FROM gl_suffixes) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- suffixProf 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Profession suffix2: ' 
     || parent_suffix_prof2 
     WHERE NVL (trim(parent_suffix_prof2), ' ') <> ' ' 
     AND parent_suffix_prof2 NOT IN 
     (SELECT gl_suffixes.campsuffix FROM gl_suffixes) 
     AND load_year = v_load_year 
     AND institution = v_institution; 

    -- race 
    UPDATE um_parent_temp 
     SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Race2: ' 
     || race2 
    WHERE NVL (trim(race2), ' ') <> ' ' 
    AND race2 NOT IN (SELECT campcode 
        FROM gl_races 
        WHERE campuscode = v_institution) 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- sex 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Sex code2: ' 
     || sex2 
    WHERE NVL (trim(parent_fn2), ' ') <> ' ' 
    AND sex2 NOT IN ('M', 'F') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Missmatching gender2 and prefix2: ' 
     || parent_prefix2 
     || ' <---> ' 
     || sex2 
    WHERE ((sex2 = 'M' 
    AND trim(parent_prefix2) IN ('Mrs.', 'Mrs', 'Miss.', 'Miss', 'Ms.', 
                   'Ms')) 
     OR (sex2 = 'F' AND trim(parent_prefix2) IN ('Mr.', 'Mr'))) 
     AND load_year = v_load_year 
     AND institution = v_institution; 

     -- address 
     UPDATE um_parent_temp 
     SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Preferred address flag2: ' 
     || pref_addr2 
     || '<br>' 
     || 'note: must also have unlisted flag set for preferred addr' 
    WHERE NVL (trim(parent_fn2), ' ') <> ' ' 
    AND pref_addr2 NOT IN ('H', 'B') 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home address2_1 is empty' 
    WHERE NVL (trim(parent_fn2), ' ') <> ' ' 
    AND pref_addr2 = 'H' 
    AND NVL (trim(home_addr2_1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Business address2 is empty' 
    WHERE NVL (trim(parent_fn2), ' ') <> ' ' 
    AND pref_addr2 = 'B' 
    AND NVL (trim(busn_addr2_1), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    -- city 
    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home city2 is empty' 
    WHERE NVL (trim(home_addr2_1), ' ') <> ' ' 
    AND NVL (trim(home_city2), ' ') = ' ' 
    AND load_year = v_load_year 
    AND institution = v_institution; 

    UPDATE um_parent_temp 
    SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Business city2 is empty' 
     WHERE NVL (trim(busn_addr2_1), ' ') <> ' ' 
     AND NVL (trim(busn_city2), ' ') = ' ' 
     AND load_year = v_load_year 
     AND institution = v_institution; 

     -- state 
     UPDATE um_parent_temp 
     SET comments  = 
      (CASE comments WHEN ' ' THEN ' ' ELSE comments || '<br>' END) 
     || 'Home state 2: ' 
     || home_state2 
    WHERE NVL (trim(home_addr2_1), ' ') <> ' ' 
    AND trim(home_country2) IN ('US', 'USA', ' ') 
    AND trim(home_state2) NOT IN (SELECT tms_states.state_code FROM  
    tms_states) 
    AND load_year = v_load_year 
    AND institution = v_institution;  

我不能輸入任何更多的代碼,但它的其餘部分類似於

+0

我在Oracle中運行了該程序,該程序運行得很好!但通過ColdFusion調用它會生成ORA-06502:PL/SQL:數字或值錯誤:字符串緩衝區太小。它指向v_summary:= 'Institution:' || v_institution || '
加載代碼:' || v_load_year || '
已檢查的總記錄數:' || TO_CHAR(v_rowcount,'99999') || '
有錯誤的記錄的總數:' || TO_CHAR(v_errorcount,'99999');如果我註釋掉這部分,proc就會運行。 – user1557856

回答

2

ColdFusion 2016不能使用<cfstoredproc>標記的DBVARNAME屬性。

從註釋

我跑的過程中甲骨文和程序跑就好了提升!但通過ColdFusion調用它會生成錯誤ORA-06502: PL/SQL: numeric or value error: character string buffer too small。它指向這條線:

v_summary := '<b>Institution:</b> ' || 
      v_institution || 
      '<br><b>Load Code:</b> ' || 
      v_load_year || 
      '<br><b>Total records checked:</b> ' || 
      TO_CHAR (v_rowcount, '99999') || 
      '<br><b>Total records with errors:</b> ' || 
      TO_CHAR (v_errorcount, '99999'); 

如果我註釋掉這部分,程序運行。

+0

有關它的更多信息,請參閱此博客文章 - [ColdFusion 11和dbvarname屬性](http://blogs.coldfusion.com/coldfusion-11-and-dbvarname-attribute/)。有關ColdFusion 2016的一些討論,請參閱評論部分 –

相關問題