jvas
jvas

Reputation: 440

Mule 3.7 - Bulk update mode for stored procedures in database

Is there a way I can have a bulk mode when I am using a stored procedure in Mule's Database component. It looks like the current version only supports it for Parameterized queries. Is there any work around available? I am trying something similar as below.

<db:insert config-ref="" bulkMode="true" doc:name="Database">
        <db:parameterized-query>
            <![CDATA[INSERT INTO TABLE (ID, BILLING_NUMBER__C, TYPE)  
            VALUES (#[payload.Id], #[payload.Billing_Number__c], #[payload.type]);]]>
        </db:parameterized-query>
    </db:insert>

But i want to replace the query with a stored procedure for which I do not see the bulkMode flag. Please help. Thanks

Upvotes: 0

Views: 938

Answers (2)

jvas
jvas

Reputation: 440

I resolved this problem. It looks like I can still do a bulk update using a stored procedure (using the new db component) by chosing the "Update" function, but using a dynamic query which is a stored-procedure. It allows me to check the Bulk-Update option and accepts an array as an input.

<db:update config-ref="L360_Database_Configuration" bulkMode="true" doc:name="Sync_LoanAppDB">
    <db:parameterized-query><![CDATA[${sp_name}]]></db:parameterized-query>
</db:update>

Upvotes: 1

Ralph Rimorin
Ralph Rimorin

Reputation: 329

You can try similar to this:

<foreach doc:name="For Each">
        <db:stored-procedure config-ref="Generic_Database_Configuration" doc:name="Call Stored Procedure Function">
            <db:parameterized-query><![CDATA[CALL callFunction(:name,:id_serv);]]></db:parameterized-query>
            <db:in-param name="display_name" type="VARCHAR" value="#[payload.name]"/>
            <db:out-param name="id_serv" type="INTEGER"/>
        </db:stored-procedure>
</foreach>

Or you can change the foreach into a batch step of Batch Processing of Mule.

Upvotes: 0

Related Questions