stored procedure invokation through camel sql-stored component

跟風遠走 提交于 2020-01-14 04:04:07

问题


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}" />

This is my stored procedure:

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?


回答1:


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"/>


来源:https://stackoverflow.com/questions/42619574/stored-procedure-invokation-through-camel-sql-stored-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!