Easysoft Blog

Fri, 07 April 2017

Updating Salesforce from Oracle

The Salesforce ODBC Driver enables you to work with Salesforce data from Oracle as though the Salesforce data was local Oracle data. You can do this from Oracle running on both Windows and non-Windows platforms.

This blog shares a workaround for an issue that one of our customers experienced when attempting to updating a Salesforce object from Oracle. The error the customer got was:

"ORA-02070: database SF does not support some function in this context"

The customer was trying to update this Salesforce data:

SQL> select "Type" from Account@SF where "Id"='001w000001CKeM8AAL';
Type
--------------------------------------------------------------------------------
Customer - Channel 2

SQL> update Account@SF set "Type"='Customer - Channel 3' where
"Id"='001w000001CKeM8AAL';
update Account@SF set "Type"='Customer - Channel 3' where
"Id"='001w000001CKeM8AAL'
                                                               *
ERROR at line 1:
ORA-02070: database SF does not support some function in this context

The workaround was to use a pass through SQL statement:

SQL> DECLARE
  2     cr NUMBER;
  3     rs NUMBER;
  4  BEGIN
  5     cr := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@SF;
  6     DBMS_HS_PASSTHROUGH.PARSE@SF(cr,'update Account set "Type"=''Customer - Channel 3'' where "Id"=''001w000001CKeM8AAL'' ');
  7     rs := DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@SF (cr);
  8     DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@SF(cr);
  9  END;
 10  /

PL/SQL procedure successfully completed.

SQL> select "Type" from Account@SF where "Id"='001w000001CKeM8AAL';

Type
--------------------------------------------------------------------------------
Customer - Channel 3

SQL>