Oracle ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小

Oracle ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小,oracle,plsql,oracle11g,Oracle,Plsql,Oracle11g,我继承了一个突然抛出错误的过程: ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小 ORA-06512:批处理服务,第408行 在过去,这通常意味着有一个参数无法保存它试图存储/获取的数据,我将其扩展为varchar24000。但是,在这种情况下,我不确定如何处理这个问题,因为在导致错误的行中没有设置参数。可能是坏数据吗 第408行: xmcgurf_index := trim(substr(job_post.right_dr,1,dr_dash_loc - 1)); 资料来

我继承了一个突然抛出错误的过程:

ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小 ORA-06512:批处理服务,第408行

在过去,这通常意味着有一个参数无法保存它试图存储/获取的数据,我将其扩展为varchar24000。但是,在这种情况下,我不确定如何处理这个问题,因为在导致错误的行中没有设置参数。可能是坏数据吗

第408行:

 xmcgurf_index := trim(substr(job_post.right_dr,1,dr_dash_loc - 1));
资料来源:

 create or replace procedure batch_media_services authid current_user as
 --
    cursor balance_upd_cursor is
       select b.ms_billing_key,
              b.ms_bl_balance,
              nvl(sum(j.ms_jb_amt),0) jb_amt_sum
         from ms_billing_dtl b, ms_job_dtl j
        where j.ms_billing_key(+) = b.ms_billing_key and
             (select global_name
                from global_name) = 'DB'
        group by b.ms_billing_key, b.ms_bl_balance;
 --
    cursor job_post_cursor is
       select j.ms_job_num,
              j.ms_jb_desc,
              j.ms_user_id,
              j.ms_jb_trans_date,
              j.ms_jb_amt,
              j.ms_jb_credit_id,
              j.ms_jb_debit_id,
              j.ms_jb_debit_acct,
              j.ms_jb_post_amt,
              j.ms_jb_post_cr,
              j.ms_jb_post_dr,
              case
                 when j.ms_jb_debit_acct = 'CASH' then 0
                 when j.ms_jb_debit_acct = 'CHECK' then 0
                 when j.ms_jb_debit_acct = 'CANCEL' then 0
                 when j.ms_jb_debit_acct = 'PENDING' then 0
                 else nvl(j.ms_jb_amt,0)
              end right_amt,
              j.ms_jb_credit_id right_cr,
              case j.ms_jb_debit_acct
                 when 'NA' then j.ms_jb_debit_id
                 when 'CASH' then j.ms_jb_debit_id
                 when 'CHECK' then j.ms_jb_debit_id
                 when 'CANCEL' then j.ms_jb_debit_id
                 when 'PENDING' then j.ms_jb_debit_id
                 when null then j.ms_jb_debit_id
                 else j.ms_jb_debit_id||'-'||j.ms_jb_debit_acct
              end right_dr,
              nvl(j.ms_jb_post_amt,0) posted_amt,
              j.ms_jb_post_cr posted_cr,
              j.ms_jb_post_dr posted_dr
         from ms_job_dtl j, ms_bill_it_mst
        where ((case
                   when j.ms_jb_debit_acct = 'CASH' then 0
                   when j.ms_jb_debit_acct = 'CHECK' then 0
                   when j.ms_jb_debit_acct = 'CANCEL' then 0
                   when j.ms_jb_debit_acct = 'PENDING' then 0
                   else nvl(j.ms_jb_amt,0)
                end) <> nvl(ms_jb_post_amt,0) or
               j.ms_jb_post_amt is null or
               j.ms_jb_credit_id <> ms_jb_post_cr or
               trim(ms_jb_post_cr) is null or
               (case j.ms_jb_debit_acct
                   when 'NA' then j.ms_jb_debit_id
                   when 'CASH' then j.ms_jb_debit_id
                   when 'CHECK' then j.ms_jb_debit_id
                   when 'CANCEL' then j.ms_jb_debit_id
                   when 'PENDING' then j.ms_jb_debit_id
                   when null then j.ms_jb_debit_id
                   else j.ms_jb_debit_id||'-'||j.ms_jb_debit_acct
                end) <> ms_jb_post_dr or
               trim(ms_jb_post_dr) is null) and
              ms_bill_it = 'Y' and
             (select global_name
                from global_name) = 'DB'
          for update of ms_jb_post_amt,
                        ms_jb_post_cr,
                        ms_jb_post_dr;
 --
    cursor je_cursor is
       select xmcgurf_batch,
              xmcgurf_batch_file,
              xmcgurf_trans_date,
              xmcgurf_description,
              xmcgurf_amount,
              xmcgurf_dr_cr_ind,
              xmcgurf_index,
              xmcgurf_account,
              xmcgurf_activity
         from xmcgurf_media_services
        where xmcgurf_trans_type = 'JE'
        order by xmcgurf_batch,
                 xmcgurf_batch_file,
                 xmcgurf_trans_date,
                 xmcgurf_description,
                 xmcgurf_amount,
                 xmcgurf_dr_cr_ind;
 --
    cursor ar_cursor is
       select xmcgurf_batch,
              xmcgurf_batch_file,
              xmcgurf_trans_date,
              xmcgurf_description,
              xmcgurf_amount,
              xmcgurf_rule_detail_code,
              xmcgurf_id,
              full_name
         from xmcgurf_media_services,
              mc_person_identification
        where xmcgurf_trans_type = 'AR' and
              id(+) = xmcgurf_id
        order by xmcgurf_batch,
                 xmcgurf_batch_file,
                 xmcgurf_trans_date,
                 xmcgurf_description,
                 xmcgurf_amount,
                 xmcgurf_id;
 --
    balance_upd        balance_upd_cursor%rowtype;
    job_post           job_post_cursor%rowtype;
    gurf               xmcgurf_media_services%rowtype;
    cr_dash_loc        number;
    cr_dash_loc2       number;
    dr_dash_loc        number;
    dr_dash_loc2       number;
    stu_ind            mc_person_identification.current_student_ind%type;
    emp_ind            mc_person_identification.current_employee_ind%type;
    je_date            date;
    ar_date            date;
 --
    je_rep             je_cursor%rowtype;
    ar_rep             ar_cursor%rowtype;
    je_count           number;
    ar_count           number;
 --
    sender             varchar2(100);
    to_list            OWA_UTIL.ident_arr;
    cc_list            OWA_UTIL.ident_arr;
    bcc_list           OWA_UTIL.ident_arr;
    msg_subj           varchar2(100);
    connection         UTL_SMTP.connection;
    line_count         number;
 --
 begin
 --
 -- make sure all balances are correct (for informational purposes only)
 --
    open balance_upd_cursor;
 --
    loop
       fetch balance_upd_cursor into balance_upd;
       exit when balance_upd_cursor%notfound;
 --
       if balance_upd.ms_bl_balance <> balance_upd.jb_amt_sum then
          update ms_billing_dtl
             set ms_bl_balance = balance_upd.jb_amt_sum
           where ms_billing_key = balance_upd.ms_billing_key;
       end if;
 --
    end loop;
 --
    if balance_upd_cursor%isopen then
       close balance_upd_cursor;
    end if;
 --
    gurf.xmcgurf_batch := 'MS'||to_char(sysdate,'yymmdd');
    gurf.xmcgurf_bank := null;
    gurf.xmcgurf_batch_file := 'MS'||to_char(sysdate,'yyyymmddhh24miss');
    gurf.xmcgurf_entry_date := sysdate;
    gurf.xmcgurf_process_date := null;
    gurf.xmcgurf_doc_code := null;
    gurf.xmcgurf_seq_num := null;
    ar_date := gurf.xmcgurf_entry_date;
 --
 -- Choose job detail entries that need to be posted
 --
    open job_post_cursor;
 --
    loop
       fetch job_post_cursor into job_post;
       exit when job_post_cursor%notfound;
 --
       je_date := job_post.ms_jb_trans_date;
       gurf.xmcgurf_description := substr('Media '||job_post.ms_job_num||
                                          ' '||job_post.ms_user_id||
                                          ' '||job_post.ms_jb_desc,1,35);
       gurf.xmcgurf_ref := substr(job_post.ms_job_num,9,8);
       gurf.xmcgurf_misc := 'MS';
 --
 -- This produces backout entries if the charge was posted
 -- to a wrong account
 --
 -- This is for the job detail charges
 --
       if (job_post.right_cr <> job_post.posted_cr and
           trim(job_post.right_cr) is not null) or
          (job_post.right_dr <> job_post.posted_dr and
           trim(job_post.right_dr) is not null) then
 --
          cr_dash_loc := instr(job_post.posted_cr,'-');
          cr_dash_loc2 := instr(job_post.posted_cr,'-',1,2);
          dr_dash_loc := instr(job_post.posted_dr,'-');
          dr_dash_loc2 := instr(job_post.posted_dr,'-',1,2);
 --
          if dr_dash_loc > 0 then
             gurf.xmcgurf_trans_type := 'JE';
             gurf.xmcgurf_trans_date := je_date;
             gurf.xmcgurf_amount := 0 - job_post.posted_amt;
             gurf.xmcgurf_dr_cr_ind := 'D';
             gurf.xmcgurf_index := trim(substr(job_post.posted_dr,1,dr_dash_loc - 1));
             if dr_dash_loc2 > 0 then
                gurf.xmcgurf_account := trim(substr(job_post.posted_dr,dr_dash_loc + 1,dr_dash_loc2 - dr_dash_loc - 1));
                gurf.xmcgurf_activity := trim(substr(job_post.posted_dr,dr_dash_loc2 + 1,6));
             else
                gurf.xmcgurf_account := trim(substr(job_post.posted_dr,dr_dash_loc + 1,6));
                gurf.xmcgurf_activity := null;
             end if;
             gurf.xmcgurf_rule_detail_code := null;
             gurf.xmcgurf_id := null;
 --
             if gurf.xmcgurf_amount <> 0 then
                insert into xmcgurf_media_services
                   (xmcgurf_trans_type,
                    xmcgurf_batch,
                    xmcgurf_trans_date,
                    xmcgurf_description,
                    xmcgurf_amount,
                    xmcgurf_dr_cr_ind,
                    xmcgurf_ref,
                    xmcgurf_index,
                    xmcgurf_account,
                    xmcgurf_misc,
                    xmcgurf_bank,
                    xmcgurf_batch_file,
                    xmcgurf_entry_date,
                    xmcgurf_process_date,
                    xmcgurf_rule_detail_code,
                    xmcgurf_id,
                    xmcgurf_activity,
                    xmcgurf_doc_code,
                    xmcgurf_seq_num)
                values
                   (gurf.xmcgurf_trans_type,
                    gurf.xmcgurf_batch,
                    gurf.xmcgurf_trans_date,
                    gurf.xmcgurf_description,
                    gurf.xmcgurf_amount,
                    gurf.xmcgurf_dr_cr_ind,
                    gurf.xmcgurf_ref,
                    gurf.xmcgurf_index,
                    gurf.xmcgurf_account,
                    gurf.xmcgurf_misc,
                    gurf.xmcgurf_bank,
                    gurf.xmcgurf_batch_file,
                    gurf.xmcgurf_entry_date,
                    gurf.xmcgurf_process_date,
                    gurf.xmcgurf_rule_detail_code,
                    gurf.xmcgurf_id,
                    gurf.xmcgurf_activity,
                    gurf.xmcgurf_doc_code,
                    gurf.xmcgurf_seq_num);
             end if;
 --
             gurf.xmcgurf_dr_cr_ind := 'C';
             gurf.xmcgurf_index := trim(substr(job_post.posted_cr,1,cr_dash_loc - 1));
             if cr_dash_loc2 > 0 then
                gurf.xmcgurf_account := trim(substr(job_post.posted_cr,cr_dash_loc + 1,cr_dash_loc2 - cr_dash_loc - 1));
                gurf.xmcgurf_activity := trim(substr(job_post.posted_cr,cr_dash_loc2 + 1,6));
             else
                gurf.xmcgurf_account := trim(substr(job_post.posted_cr,cr_dash_loc + 1,6));
                gurf.xmcgurf_activity := null;
             end if;
 --
             if gurf.xmcgurf_amount <> 0 then
                insert into xmcgurf_media_services
                   (xmcgurf_trans_type,
                    xmcgurf_batch,
                    xmcgurf_trans_date,
                    xmcgurf_description,
                    xmcgurf_amount,
                    xmcgurf_dr_cr_ind,
                    xmcgurf_ref,
                    xmcgurf_index,
                    xmcgurf_account,
                    xmcgurf_misc,
                    xmcgurf_bank,
                    xmcgurf_batch_file,
                    xmcgurf_entry_date,
                    xmcgurf_process_date,
                    xmcgurf_rule_detail_code,
                    xmcgurf_id,
                    xmcgurf_activity,
                    xmcgurf_doc_code,
                    xmcgurf_seq_num)
                values
                   (gurf.xmcgurf_trans_type,
                    gurf.xmcgurf_batch,
                    gurf.xmcgurf_trans_date,
                    gurf.xmcgurf_description,
                    gurf.xmcgurf_amount,
                    gurf.xmcgurf_dr_cr_ind,
                    gurf.xmcgurf_ref,
                    gurf.xmcgurf_index,
                    gurf.xmcgurf_account,
                    gurf.xmcgurf_misc,
                    gurf.xmcgurf_bank,
                    gurf.xmcgurf_batch_file,
                    gurf.xmcgurf_entry_date,
                    gurf.xmcgurf_process_date,
                    gurf.xmcgurf_rule_detail_code,
                    gurf.xmcgurf_id,
                    gurf.xmcgurf_activity,
                    gurf.xmcgurf_doc_code,
                    gurf.xmcgurf_seq_num);
             end if;
 --
          else
             gurf.xmcgurf_trans_type := 'AR';
             gurf.xmcgurf_trans_date := ar_date;
             gurf.xmcgurf_amount := 0 - job_post.posted_amt;
             gurf.xmcgurf_dr_cr_ind := null;
             gurf.xmcgurf_index := trim(substr(job_post.posted_cr,1,cr_dash_loc - 1));
             if cr_dash_loc2 > 0 then
                gurf.xmcgurf_account := trim(substr(job_post.posted_cr,cr_dash_loc + 1,cr_dash_loc2 - cr_dash_loc - 1));
                gurf.xmcgurf_activity := trim(substr(job_post.posted_cr,cr_dash_loc2 + 1,6));
             else
                gurf.xmcgurf_account := trim(substr(job_post.posted_cr,cr_dash_loc + 1,6));
                gurf.xmcgurf_activity := null;
             end if;
             select max(current_student_ind), max(current_employee_ind)
               into stu_ind, emp_ind
               from mc_person_identification
              where id = trim(job_post.posted_dr);
             if stu_ind = 'U' then
                gurf.xmcgurf_rule_detail_code := 'FDST';
             elsif stu_ind = 'G' then
                gurf.xmcgurf_rule_detail_code := 'FDGR';
             elsif emp_ind = 'Y' then
                gurf.xmcgurf_rule_detail_code := 'FDEM';
             else
                gurf.xmcgurf_rule_detail_code := 'FDOR';
             end if;
             gurf.xmcgurf_id := trim(job_post.posted_dr);
 --
             if gurf.xmcgurf_amount <> 0 then
                insert into xmcgurf_media_services
                   (xmcgurf_trans_type,
                    xmcgurf_batch,
                    xmcgurf_trans_date,
                    xmcgurf_description,
                    xmcgurf_amount,
                    xmcgurf_dr_cr_ind,
                    xmcgurf_ref,
                    xmcgurf_index,
                    xmcgurf_account,
                    xmcgurf_misc,
                    xmcgurf_bank,
                    xmcgurf_batch_file,
                    xmcgurf_entry_date,
                    xmcgurf_process_date,
                    xmcgurf_rule_detail_code,
                    xmcgurf_id,
                    xmcgurf_activity,
                    xmcgurf_doc_code,
                    xmcgurf_seq_num)
                values
                   (gurf.xmcgurf_trans_type,
                    gurf.xmcgurf_batch,
                    gurf.xmcgurf_trans_date,
                    gurf.xmcgurf_description,
                    gurf.xmcgurf_amount,
                    gurf.xmcgurf_dr_cr_ind,
                    gurf.xmcgurf_ref,
                    gurf.xmcgurf_index,
                    gurf.xmcgurf_account,
                    gurf.xmcgurf_misc,
                    gurf.xmcgurf_bank,
                    gurf.xmcgurf_batch_file,
                    gurf.xmcgurf_entry_date,
                    gurf.xmcgurf_process_date,
                    gurf.xmcgurf_rule_detail_code,
                    gurf.xmcgurf_id,
                    gurf.xmcgurf_activity,
                    gurf.xmcgurf_doc_code,
                    gurf.xmcgurf_seq_num);
             end if;
 --
          end if;
 --
       end if;
 --
 -- This produces entries if the charge has not been posted
 -- or if the amount has changed
 --
 -- This is for the job detail charges
 --
       cr_dash_loc := instr(job_post.right_cr,'-');
       cr_dash_loc2 := instr(job_post.right_cr,'-',1,2);
       dr_dash_loc := instr(job_post.right_dr,'-');
       dr_dash_loc2 := instr(job_post.right_dr,'-',1,2);
 --
 --
       if dr_dash_loc > 0 then
          gurf.xmcgurf_trans_type := 'JE';
          gurf.xmcgurf_trans_date := je_date;
          if (job_post.right_cr = job_post.posted_cr or
              trim(job_post.posted_cr) is null) and
             (job_post.right_dr = job_post.posted_dr or
              trim(job_post.posted_dr) is null) then
             gurf.xmcgurf_amount := job_post.right_amt - job_post.posted_amt;
          else
             gurf.xmcgurf_amount := job_post.right_amt;
          end if;
          gurf.xmcgurf_dr_cr_ind := 'D';
          gurf.xmcgurf_index := trim(substr(job_post.right_dr,1,dr_dash_loc - 1));
          if dr_dash_loc2 > 0 then
             gurf.xmcgurf_account := trim(substr(job_post.right_dr,dr_dash_loc + 1,dr_dash_loc2 - dr_dash_loc - 1));
             gurf.xmcgurf_activity := trim(substr(job_post.right_dr,dr_dash_loc2 + 1,6));
          else
             gurf.xmcgurf_account := trim(substr(job_post.right_dr,dr_dash_loc + 1,6));
             gurf.xmcgurf_activity := null;
          end if;
          gurf.xmcgurf_rule_detail_code := null;
          gurf.xmcgurf_id := null;
 --
          if gurf.xmcgurf_amount <> 0 then
             insert into xmcgurf_media_services
                (xmcgurf_trans_type,
                 xmcgurf_batch,
                 xmcgurf_trans_date,
                 xmcgurf_description,
                 xmcgurf_amount,
                 xmcgurf_dr_cr_ind,
                 xmcgurf_ref,
                 xmcgurf_index,
                 xmcgurf_account,
                 xmcgurf_misc,
                 xmcgurf_bank,
                 xmcgurf_batch_file,
                 xmcgurf_entry_date,
                 xmcgurf_process_date,
                 xmcgurf_rule_detail_code,
                 xmcgurf_id,
                 xmcgurf_activity,
                 xmcgurf_doc_code,
                 xmcgurf_seq_num)
             values
                (gurf.xmcgurf_trans_type,
                 gurf.xmcgurf_batch,
                 gurf.xmcgurf_trans_date,
                 gurf.xmcgurf_description,
                 gurf.xmcgurf_amount,
                 gurf.xmcgurf_dr_cr_ind,
                 gurf.xmcgurf_ref,
                 gurf.xmcgurf_index,
                 gurf.xmcgurf_account,
                 gurf.xmcgurf_misc,
                 gurf.xmcgurf_bank,
                 gurf.xmcgurf_batch_file,
                 gurf.xmcgurf_entry_date,
                 gurf.xmcgurf_process_date,
                 gurf.xmcgurf_rule_detail_code,
                 gurf.xmcgurf_id,
                 gurf.xmcgurf_activity,
                 gurf.xmcgurf_doc_code,
                 gurf.xmcgurf_seq_num);
          end if;
 --
          gurf.xmcgurf_dr_cr_ind := 'C';
          gurf.xmcgurf_index := trim(substr(job_post.right_cr,1,cr_dash_loc - 1));
          if cr_dash_loc2 > 0 then
             gurf.xmcgurf_account := trim(substr(job_post.right_cr,cr_dash_loc + 1,cr_dash_loc2 - cr_dash_loc - 1));
             gurf.xmcgurf_activity := trim(substr(job_post.right_cr,cr_dash_loc2 + 1,6));
          else
             gurf.xmcgurf_account := trim(substr(job_post.right_cr,cr_dash_loc + 1,6));
             gurf.xmcgurf_activity := null;
          end if;
 --
          if gurf.xmcgurf_amount <> 0 then
             insert into xmcgurf_media_services
                (xmcgurf_trans_type,
                 xmcgurf_batch,
                 xmcgurf_trans_date,
                 xmcgurf_description,
                 xmcgurf_amount,
                 xmcgurf_dr_cr_ind,
                 xmcgurf_ref,
                 xmcgurf_index,
                 xmcgurf_account,
                 xmcgurf_misc,
                 xmcgurf_bank,
                 xmcgurf_batch_file,
                 xmcgurf_entry_date,
                 xmcgurf_process_date,
                 xmcgurf_rule_detail_code,
                 xmcgurf_id,
                 xmcgurf_activity,
                 xmcgurf_doc_code,
                 xmcgurf_seq_num)
             values
                (gurf.xmcgurf_trans_type,
                 gurf.xmcgurf_batch,
                 gurf.xmcgurf_trans_date,
                 gurf.xmcgurf_description,
                 gurf.xmcgurf_amount,
                 gurf.xmcgurf_dr_cr_ind,
                 gurf.xmcgurf_ref,
                 gurf.xmcgurf_index,
                 gurf.xmcgurf_account,
                 gurf.xmcgurf_misc,
                 gurf.xmcgurf_bank,
                 gurf.xmcgurf_batch_file,
                 gurf.xmcgurf_entry_date,
                 gurf.xmcgurf_process_date,
                 gurf.xmcgurf_rule_detail_code,
                 gurf.xmcgurf_id,
                 gurf.xmcgurf_activity,
                 gurf.xmcgurf_doc_code,
                 gurf.xmcgurf_seq_num);
          end if;
 --
       else
          gurf.xmcgurf_trans_type := 'AR';
          gurf.xmcgurf_trans_date := ar_date;
          if (job_post.right_cr = job_post.posted_cr or
              trim(job_post.posted_cr) is null) and
             (job_post.right_dr = job_post.posted_dr or
              trim(job_post.posted_dr) is null) then
             gurf.xmcgurf_amount := job_post.right_amt - job_post.posted_amt;
          else
             gurf.xmcgurf_amount := job_post.right_amt;
          end if;
          gurf.xmcgurf_dr_cr_ind := null;
          gurf.xmcgurf_index := trim(substr(job_post.right_cr,1,cr_dash_loc - 1));
          if cr_dash_loc2 > 0 then
             gurf.xmcgurf_account := trim(substr(job_post.right_cr,cr_dash_loc + 1,cr_dash_loc2 - cr_dash_loc - 1));
             gurf.xmcgurf_activity := trim(substr(job_post.right_cr,cr_dash_loc2 + 1,6));
          else
             gurf.xmcgurf_account := trim(substr(job_post.right_cr,cr_dash_loc + 1,6));
             gurf.xmcgurf_activity := null;
          end if;
          select max(current_student_ind), max(current_employee_ind)
            into stu_ind, emp_ind
            from mc_person_identification
           where id = trim(job_post.right_dr) ;
          if stu_ind = 'U' then
             gurf.xmcgurf_rule_detail_code := 'FDST';
          elsif stu_ind = 'G' then
             gurf.xmcgurf_rule_detail_code := 'FDGR';
          elsif emp_ind = 'Y' then
             gurf.xmcgurf_rule_detail_code := 'FDEM';
          else
             gurf.xmcgurf_rule_detail_code := 'FDOR';
          end if;
          gurf.xmcgurf_id := trim(job_post.right_dr);
 --
          if gurf.xmcgurf_amount <> 0 then
             insert into xmcgurf_media_services
                (xmcgurf_trans_type,
                 xmcgurf_batch,
                 xmcgurf_trans_date,
                 xmcgurf_description,
                 xmcgurf_amount,
                 xmcgurf_dr_cr_ind,
                 xmcgurf_ref,
                 xmcgurf_index,
                 xmcgurf_account,
                 xmcgurf_misc,
                 xmcgurf_bank,
                 xmcgurf_batch_file,
                 xmcgurf_entry_date,
                 xmcgurf_process_date,
                 xmcgurf_rule_detail_code,
                 xmcgurf_id,
                 xmcgurf_activity,
                 xmcgurf_doc_code,
                 xmcgurf_seq_num)
             values
                (gurf.xmcgurf_trans_type,
                 gurf.xmcgurf_batch,
                 gurf.xmcgurf_trans_date,
                 gurf.xmcgurf_description,
                 gurf.xmcgurf_amount,
                 gurf.xmcgurf_dr_cr_ind,
                 gurf.xmcgurf_ref,
                 gurf.xmcgurf_index,
                 gurf.xmcgurf_account,
                 gurf.xmcgurf_misc,
                 gurf.xmcgurf_bank,
                 gurf.xmcgurf_batch_file,
                 gurf.xmcgurf_entry_date,
                 gurf.xmcgurf_process_date,
                 gurf.xmcgurf_rule_detail_code,
                 gurf.xmcgurf_id,
                 gurf.xmcgurf_activity,
                 gurf.xmcgurf_doc_code,
                 gurf.xmcgurf_seq_num);
          end if;
 --
       end if;
 --
       update ms_job_dtl
            set ms_jb_post_amt = job_post.right_amt,
                ms_jb_post_cr = job_post.right_cr,
                ms_jb_post_dr = job_post.right_dr
          where current of job_post_cursor;
 --
    end loop;
 --
    if job_post_cursor%isopen then
       close job_post_cursor;
    end if;

这句话实际上是这样的:

gurf.xmcgurf_index := trim(substr(job_post.right_dr,1,dr_dash_loc - 1));
你忽略了导师。在您引用的版本中添加一部分

包括xmcgurf_索引在内的gurf在此声明:

gurf               xmcgurf_media_services%rowtype;
如果您查看xmcgurf_media_services.xmcgurf_index的定义,您会发现它是一个字符。。。或者VARCHAR2。。。或者有特定长度的东西;问题是,trimsubstrjob_post.right_dr,1,dr_dash_loc-1超过了这个长度

事实上,您确实尝试将gurf.xmcgurf_index的值放入INSERT语句中的xmcgurf_media_services.xmcgurf_index中,所以这不是一个小问题:您有一个数据库列,一个不适合该列的值,但您需要将该值存储在那里

如何解决这个问题是一个需求问题。我认为有三种可能:

也许数据库列实际上需要支持比它更宽的值,并且您需要加宽该列。 如果您必须截断该值以匹配列的宽度,并且在末尾丢失一些文本,那么这可能不是什么大问题。 也许这个列是可选的,可以为null,如果值不合适,可以在其中存储null。 这里没有人可以帮助您确定哪一个(如果有的话)适合您的用例


顺便说一句,我建议你注意上面的评论中的建议。你可能继承了这个程序,但现在它是你的,你必须拥有它。如果它太大和难于调试它,那么你应该强烈地考虑将它重构成更好和更容易处理的更小的部分。

你对错误的分析是通常的。然而,我想知道,你到底希望有谁能帮上忙?我们无法访问运行大量代码所需的任何数据或对象。你需要自己调试这个。开始删除代码,直到你找到一个最小数量的代码仍然有错误,即你不能删除任何东西。如果您仍然无法解决这个问题,那么提供对象DDL和少量DML来生成所需的数据。检查这是否仍然会导致错误。如果没有,您就找到了它-它是数据,所以查找它。P.s.,您的过程有604行长,缺少一个结尾,即无法编译。。。难怪你在找出问题所在时遇到问题。作为调试的一部分,考虑将其重构为更小、更合理的单元。从长远来看,这会让你的生活更轻松。