【问题标题】:Why this simple query is failing in a mule flow?为什么这个简单的查询在 mule 流中失败?
【发布时间】:2016-06-24 20:29:16
【问题描述】:

我必须在几乎没有知识的情况下对现有的 mule 流程进行一些更改,尽管我已经花了几天时间阅读在线文档和可能的解决方案,但我无法弄清楚为什么这个查询会失败,因为我还有更多动态在我的流程中使用 #[xxx] 参数进行查询。查询如下:

select times from user_request where 
ip_address=SUBSTR(#message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS],2,INSTR(#[message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS], ':')-2) 
    and request_date=CAST(CURRENT_DATE as varchar2(8))

我得到的错误是:

消息:索引:0 (java.lang.IndexOutOfBoundsException)。有效载荷: {fecha_solicitud=2016-06-22,moneda=USD,client_id=RIVERA, user_ip=127.0.0.1, request_times=0} 负载类型: java.util.LinkedHashMap 元素: /OANDAFlow/processors/3@oanda:oanda.xml:126 元素 XML: 从 user_requestwhere 中选择时间 ip_address=SUBSTR(#[message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS],2,INSTR(#[message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS], ':')-2) 和 request_date=CAST(CURRENT_DATE 为 varchar2(8))>

注意:日期转换为varchar是因为request_date列是varchar。

我已经在 Oracle SQL 开发人员中直接尝试了这个查询,替换了 #[message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS]/127.0.0.1:55406之类的例子,它工作得很好,那么为什么通过mule会失败???

【问题讨论】:

    标签: sql oracle mule mule-el anypoint-studio


    【解决方案1】:

    在第一个:#message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS] 你缺少一个[

    【讨论】:

    • 其实我在代码里有括号,不知道我做的复制粘贴有没有被这个页面编辑器转换...无论如何谢谢!
    【解决方案2】:

    您的查询中的一个字段需要一个字符串值尝试放一个单引号..它会工作,

    试试这个 select times from user_request where ip_address=SUBSTR('#message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS]',2,'INSTR(#[message.inboundProperties.MULE_REMOTE_CLIENT_ADDRESS]', ':')-2) and request_date=CAST(CURRENT_DATE as varchar2(8))

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-01
      • 2011-08-08
      • 1970-01-01
      • 1970-01-01
      • 2012-06-13
      • 2021-03-17
      • 2016-09-23
      相关资源
      最近更新 更多