[ 
https://issues.apache.org/jira/browse/CAMEL-4725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15876741#comment-15876741
 ] 

Arno Noordover commented on CAMEL-4725:
---------------------------------------

Example in derby:
(create a Person class for yourself)
{code}
CREATE TYPE person EXTERNAL NAME
 'org.apache.camel.component.sql.Person' LANGUAGE JAVA;

CREATE PROCEDURE fullName(person, OUT RESULT VARCHAR(255))
LANGUAGE JAVA
PARAMETER STYLE JAVA
NO SQL
EXTERNAL NAME 'org.apache.camel.component.sql.Person.fullName';
{code}

and

{code}
    @Test
    public void shouldExecuteStoredFunction() throws Exception {

        CallableStatementWrapper wrapper = new 
CallableStatementWrapper("fullName"
                + "(JAVA_OBJECT ${header.v1}, OUT VARCHAR resultofsub)", 
factory);

        final Exchange exchange = createExchangeWithBody(null);
        Person person = new Person();
        person.lastname = "Noordover";
        person.firstname = "Arno";
        exchange.getIn().setHeader("v1", person);

        wrapper.call(new WrapperExecuteCallback() {
            @Override
            public void execute(StatementWrapper statementWrapper) throws 
SQLException, DataAccessException {
                statementWrapper.populateStatement(null, exchange);

                Map resultOfQuery = (Map) statementWrapper.executeStatement();
                Assert.assertEquals("Arno Noordover", 
resultOfQuery.get("resultofsub"));
            }
        });
    }
{code}

> camel-sql - Add support for Callable statements
> -----------------------------------------------
>
>                 Key: CAMEL-4725
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4725
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-sql
>    Affects Versions: 2.8.3
>            Reporter: Christian Müller
>            Assignee: Claus Ibsen
>             Fix For: 2.17.0
>
>
> See 
> [Nabble|http://camel.465427.n5.nabble.com/call-Oracle-Package-procedure-td5032133.html]
>  for details.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to