通过camel sql-stored组件调用存储过程 [英] stored procedure invokation through camel sql-stored component

查看:18
本文介绍了通过camel sql-stored组件调用存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是骆驼 sql 存储组件的新手.目前我正在使用 Camel 2.17.5.我正在尝试从骆驼路线调用 oracle 存储过程.这是我的路线:

I am new to camel sql-stored component. Currently I am using Camel 2.17.5. And I am trying to invoke oracle stored procedure from camel route. This is my route:

<setHeader headerName="test">
                        <simple>John</simple>
                    </setHeader>
                    <log loggingLevel="INFO" message="value: ${headers.test}" />
                    <to uri="sql-stored:HELLO(VARCHAR ${headers.test},OUT  VARCHAR outparam1)?dataSource=oracleDataSource"/>
                    <log loggingLevel="INFO" message="SP result: ${body}" />

这是我的存储过程:

CREATE OR REPLACE PROCEDURE hello(param1 IN varchar2, outparam1 OUT varchar2)
AS
BEGIN 
select password INTO outparam1 from dbuser WHERE USERNAME=param1;
END;

但是当我运行我的路线时,它给了我错误:

But when I run my route it gives me error:

    org.apache.camel.component.sql.stored.template.ast.ParseRuntimeException: org.apache.camel.component.sql.stored.template.generated.ParseException: Encountered " " " "  "" at line 1, column 35.
Was expecting one of:
    <NUMBER> ...
    <IDENTIFIER> ...
    at org.apache.camel.component.sql.stored.template.TemplateParser.parseTemplate(TemplateParser.java:36)
    at org.apache.camel.component.sql.stored.CallableStatementWrapperFactory.getTemplateStoredProcedure(CallableStatementWrapperFactory.java:71)

你能帮帮我,这里有什么问题吗?

could you help me, what is wrong here?

推荐答案

正如克劳斯上面指出的,这是我的语法错误.我刚刚删除了双空格,它可以工作!所以调用行应该是这样的:

As pointed above Claus it was my syntax error. I just removed double spaces and it works! So invokation line should be like this:

<to uri="sql-stored:hello(VARCHAR ${headers.test},OUT VARCHAR outparam1)?dataSource=oracleDataSource"/>

这篇关于通过camel sql-stored组件调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆