HTML报表日期格式不对 导致报错ORA-01861: 文字与格式字符串不匹配

时间:2022-09-17 07:47:18
  PROCEDURE MAIN(ERRBUF        OUT VARCHAR2,
                 RETCODE       OUT VARCHAR2,
                 P_CUSTOMER_ID IN VARCHAR2,
                 P_PERSON_ID   IN VARCHAR2, 
                 P_MAKER_ID    IN VARCHAR2, 
                 P_START_DATE IN VARCHAR2, --这里为字符格式
                 P_END_DATE   IN VARCHAR2 --这里为字符格式
                 ) IS
  
    l_contract_date_from DATE; -- 合同日期至
    l_contract_date_to   DATE; -- 合同日期至
  BEGIN
    RETCODE              := '0';
    l_contract_date_from := trunc(fnd_conc_date.string_to_date(P_START_DATE));--调用函数转化为日期格式
    l_contract_date_to   := trunc(fnd_conc_date.string_to_date(P_END_DATE));--调用函数转化日期格式
    OUTPUT_DATA_HTML(P_CUSTOMER_ID, 
                     P_PERSON_ID, 
                     P_MAKER_ID, 
                     l_contract_date_from, --销售日期从
                     l_contract_date_to --销售日期至
                     );
  END;


 PROCEDURE output_data_html(P_CUSTOMER_ID IN VARCHAR2,
                            P_PERSON_ID   IN VARCHAR2,
                            P_MAKER_ID    IN VARCHAR2,
                            P_START_DATE  IN DATE, --这里为日期格式
                            P_END_DATE    IN DATE --这里为日期格式
                            ) IS
 BEGIN
 
   SELECT *
     FROM OE_ORDER_HEADERS_ALL OOH
    WHERE (p_start_date IS NULL OR trunc(ooh.ordered_date) >= p_start_date)
      AND (p_end_date IS NULL OR trunc(ooh.ordered_date) <= p_end_date);
 END;


--程序定义的参数时候的值集为 FND_STANDARD_DATE