通过 camel sql-存储组件调用存储过程
stored procedure invokation through camel sql-stored component
我是 camel sql 存储组件的新手。目前我正在使用 Camel 2.17.5。我正在尝试从骆驼路线调用 oracle 存储过程。这是我的路线:
<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;
但是当我 运行 我的路线时它给我错误:
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)
你能帮帮我吗,这里有什么问题?
正如上面 Claus 所指出的,这是我的语法错误。我刚刚删除了双空格并且它有效!
所以调用行应该是这样的:
<to uri="sql-stored:hello(VARCHAR ${headers.test},OUT VARCHAR outparam1)?dataSource=oracleDataSource"/>
我是 camel sql 存储组件的新手。目前我正在使用 Camel 2.17.5。我正在尝试从骆驼路线调用 oracle 存储过程。这是我的路线:
<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;
但是当我 运行 我的路线时它给我错误:
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)
你能帮帮我吗,这里有什么问题?
正如上面 Claus 所指出的,这是我的语法错误。我刚刚删除了双空格并且它有效! 所以调用行应该是这样的:
<to uri="sql-stored:hello(VARCHAR ${headers.test},OUT VARCHAR outparam1)?dataSource=oracleDataSource"/>