2016-08-03 56 views
0

以下函数包含在从shell脚本调用的PLSQL包中。它失败,因为找不到JIT_TIME。我很难找出这个值来自哪里。它显然不作为参数传递,不存储在任何数据库表中,不从任何其他数据库对象中检索。代码失败,因为未找到JIT_TIME的值

Function ADD_START_DATE(p_process_type char, p_profet_cntl_no char, p_error_file UTL_FILE.FILE_TYPE) return boolean is                     
     v_profet_control_no  char(10);                                           
     v_jit_time    date;                                             
    BEGIN                                                 
     BEGIN                                                 
      SELECT  contr_numb                                             
      INTO  v_profet_control_no                                            
      FROM  prd_contr                                              
      WHERE  end_date_time is null                                           
      AND   start_date_time is not null                                          
      AND   rownum=1;                                              
      PKG_WRITE_ERROR.writeError(p_error_File , 'PRD-01601','ProFET Control No.='||v_profet_control_no);                         
      return false;                                               
     EXCEPTION                                                
      when NO_DATA_FOUND then                                            
       null;                                                
     END;                                                 
     lock table prd_contr in exclusive mode nowait;                                       
     BEGIN                                                 
--                                                  
-- A new Begin-End block has been added for jit_time function. If the value                                
-- of jit_time is not found, in case of complete refresh, an error is logged                                
-- and the process exits. In case of routine, jit_time error is ignored.                                 
--                                                  
      BEGIN                                                 
       v_jit_time:=jit_time;                                            
      EXCEPTION                                                
       when OTHERS then                                              
        IF p_process_type = 'C' then                                          
         PKG_WRITE_ERROR.writeError(p_error_File , 'PRD-01604', '');                                  
         return false;                                              
        END IF;                                                
      END;                                                 
      INSERT into prd_contr(start_date_time, end_date_time, idp1_xfer,                                  
        proc_type, contr_numb, idp1_time)                                         
      VALUES(SYSDATE, '','', p_process_type, p_profet_cntl_no,v_jit_time);                                 
     EXCEPTION                                                
      when OTHERS then                                              
       return false;                                              
     END;                                                 
     commit;                                                
     return true;                                               
    EXCEPTION                                                
     when TIMEOUT_ON_RESOURCE then                                           
      PKG_WRITE_ERROR.writeError(p_error_File , 'PRD-01602', '');                                   
      return false;                                               
     when OTHERS then                                              
      PKG_WRITE_ERROR.writeError(p_error_File, 'PRD-01699',substr(SQLERRM,1,100));                               
      return false;                                               
    END ADD_START_DATE; 
+0

更新: - JIT_TIME是与上游 – user2295715

+0

JIT_TIME数据库链接连接到其接受车辆的上游系统命令 。 – user2295715

回答

0

我注意到,可变日期与v_jit_time类型定义,但从来没有used.In另一方面,有一个变量,jit_time,即从未定义。 我的事情他们就可能成为:

Function ADD_START_DATE(p_process_type char, p_profet_cntl_no char, p_error_file UTL_FILE.FILE_TYPE) return boolean is                     
     v_profet_control_no  char(10);                                           
     v_jit_time    jit_time;                                             
    BEGIN                                                 
     BEGIN                                                 
      SELECT  contr_numb                                             
      INTO  v_profet_control_no                                            
      FROM  prd_contr                                              
      WHERE  end_date_time is null                                           
      AND   start_date_time is not null                                          
      AND   rownum=1;                                              
      PKG_WRITE_ERROR.writeError(p_error_File , 'PRD-01601','ProFET Control No.='||v_profet_control_no);                         
      return false;                                               
     EXCEPTION                                                
      when NO_DATA_FOUND then                                            
       null;                                                
     END;                                                 
     lock table prd_contr in exclusive mode nowait;                                       
     BEGIN                                                 
--                                                  
-- A new Begin-End block has been added for jit_time function. If the value                                
-- of jit_time is not found, in case of complete refresh, an error is logged                                
-- and the process exits. In case of routine, jit_time error is ignored.                                 
--                                                  
      BEGIN                                                 
       v_jit_time:=jit_time;                                            
      EXCEPTION                                                
       when OTHERS then                                              
        IF p_process_type = 'C' then                                          
         PKG_WRITE_ERROR.writeError(p_error_File , 'PRD-01604', '');                                  
         return false;                                              
        END IF;                                                
      END;                                                 
      INSERT into prd_contr(start_date_time, end_date_time, idp1_xfer,                                  
        proc_type, contr_numb, idp1_time)                                         
      VALUES(SYSDATE, '','', p_process_type, p_profet_cntl_no,v_jit_time);                                 
     EXCEPTION                                                
      when OTHERS then                                              
       return false;                                              
     END;                                                 
     commit;                                                
     return true;                                               
    EXCEPTION                                                
     when TIMEOUT_ON_RESOURCE then                                           
      PKG_WRITE_ERROR.writeError(p_error_File , 'PRD-01602', '');                                   
      return false;                                               
     when OTHERS then                                              
      PKG_WRITE_ERROR.writeError(p_error_File, 'PRD-01699',substr(SQLERRM,1,100));                               
      return false;                                               
    END ADD_START_DATE; 
0

至于我能理解JIT_TIME功能。 所以你应该在函数定义中进行搜索 - 而不是参数,变量或表格。

另外程序员显然在某些情况下,预计该函数作为评价看到不被发现

-- If the value                                
-- of jit_time is not found, in case of complete refresh, an error is logged                                
-- and the process exits. In case of routine, jit_time error is ignored. 
+0

嗨,刚刚与DBA团队合作,发现它是一个数据库链接。 – user2295715

+1

这听起来不对。 JIT_TIME的类型是日期,因为v_jit_time是日期...所以它可以使用数据库链接...但我不认为它是一个数据库链接本身。 – Plirkee

相关问题