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

时间:2014-12-15 21:23:10

标签: oracle plsql oracle11g

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

ORA-06502:PL / SQL:数字或值错误:字符串缓冲区太小 ORA-06512:在" BATCH_SERVICES",第408行

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

第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;

1 个答案:

答案 0 :(得分:1)

有问题的一行实际上就是这样:

gurf.xmcgurf_index := trim(substr(job_post.right_dr,1,dr_dash_loc - 1));

(您在引用的版本中遗漏了gurf.部分。)

gurf,包括xmcgurf_index,在此声明:

gurf               xmcgurf_media_services%rowtype;

如果您查看xmcgurf_media_services.xmcgurf_index的定义,您会发现它是CHAR(...)VARCHAR2(...)或其他具有指定长度的内容;问题是trim(substr(job_post.right_dr,1,dr_dash_loc - 1))超过了那个长度。

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

如何解决这个问题是一个需求问题。我看到了三种可能的可能性:

  • 也许数据库列实际上需要支持比它更宽的值,并且你需要扩大列。
  • 如果您必须截断该值以匹配列的宽度,并且最后丢失一些文本,那么这可能不是什么大问题。
  • 也许这个列是可选的(可空),它是O.K.如果值不合适,则在那里存储null。

这里没有人可以帮助您确定哪些(如果有的话)对您的用例是正确的。


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