Search code examples
apache-camelcamel-sql

stored procedure invokation through camel sql-stored component


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?


Solution

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