首页 文章

带有OSB存储过程的DB适配器

提问于
浏览
0

感谢,如果有人帮我解决这个问题 .

我想在OSB中使用DB适配器从DB中选择一条记录,为此我在oracle中编写了一个存储过程,如下所示: -

create or replace
PROCEDURE TRY_POC(ERROR_STATUS IN varchar2,TYPE_ERROR IN  varchar2,ERROR_TIMESTAMP IN varchar2,p_cur out sys_refcursor) IS

BEGIN

open p_cur for
select * from CommonLogTable where STATUS=ERROR_STATUS
and ERROR_TYPE=TYPE_ERROR
and
 to_date(
(
substr(Error_Timestamp,9,2)||'-'||
substr(Error_Timestamp,6,2)||'-'||
substr(Error_Timestamp,1,4)||' '||
substr(Error_Timestamp,12,2)||':'||
substr(Error_Timestamp,15,2)||':'||
substr(Error_Timestamp,18,2)
),'DD-MM-YYYY HH24:MI:SS') < to_date(to_char(current_timestamp,'DD-MM-YYYY HH24:MI:SS'),'DD-MM-YYYY HH24:MI:SS')
AND  to_date(
(
substr(Error_Timestamp,9,2)||'-'||
substr(Error_Timestamp,6,2)||'-'||
substr(error_timestamp,1,4)||' '||
substr(Error_Timestamp,12,2)||':'||
substr(Error_Timestamp,15,2)||':'||
substr(Error_Timestamp,18,2)
),'DD-MM-YYYY HH24:MI:SS') >= to_date(to_char(current_timestamp-(5 * (1/24/60)),'DD-MM-YYYY HH24:MI:SS'),'DD-MM-
YYYY HH24:MI:SS');
end TRY_POC;

这个存储过程正在做什么,它根据Status,Error_Type和Error_Timestamp(将在运行时传递)从CommonLoTable获取te记录,并获取介于两者之间的记录

当前时间戳=当前时间戳-5我需要的错误时间戳格式如2016-08-13T16:30:00 .

我想在运行时传递所有Error_Type,Status和Error_Timestamp的值 . 我无法在运行时从OSB传递Error_Timestamp的值 .

提前致谢

1 回答

  • 0

    您可以在管道中使用xquery函数execute-sql()并调用您的sql语句 . 输入参数可以在运行时从代理服务接受,然后将这些值映射到sql查询条件参数 .

相关问题