function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tomas.RayTomas.Ray 

How to use apex data loader in batch mode to delete records in oracle database

Hi All,

I have a business challenge:

Customer wanna maintain master data in sfdc. Master data can be created, updated and deactivated in SFDC.  They want to sycn any change to oracle database. If master data record is deactivated in SFDC, the same record should be deleted in oracle database.

Proposal is to use apex data loader to query in sfdc to insert, update or delete records in oracle database accordingly. The proposal is based on the sample database-conf.xml in apex dataloader installation folder.
<!--- this is for updating Customers in Oracle based on SFDC Accounts -->
<bean id="updateAccountSql"
      class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
            update TableOwner.Accounts accounts
               set accounts.account_name = @account_name@,
                   accounts.business_phone = @business_phone@,
                   accounts.sfdc_account_id = @sfdc_account_id@,
                   accounts.annual_revenue = @annual_revenue@,
                   accounts.account_number = @account_number@
            where
                   accounts.ACCOUNT_EXT_ID = @account_ext_id@
        </value>
    </property>
    <property name="sqlParams">
        <map>
            <entry key="account_name"    value="java.lang.String"/>
            <entry key="business_phone"  value="java.lang.String"/>
            <entry key="sfdc_account_id" value="java.lang.String"/>
            <entry key="annual_revenue"  value="java.lang.Double"/>
            <entry key="account_ext_id"  value="java.lang.String"/>
            <entry key="account_number"  value="java.lang.String"/>
        </map>
    </property>
</bean>


Really appreciate it if you can advise whether the proposal is possible.

Regards,
Thomas