I get an ORA-02070 error when using DG4ODBC to insert data into SQL Server. What can I do?

Oracle DG4ODBC does not support functions within INSERT statements. If you attempt to do this, you will get an ORA-02070 error. For example:

INSERT INTO vc@odbc ("c1") VALUES (current_timestamp);
ORA-02070: database ODBC does not support operator 293 in this context
INSERT INTO vc@odbc ("c1") VALUES (sysdate);
ORA-02070: database ODBC does not support special functions in this context

We worked around this issue in the following way:

  1. We created this SQL Server table:
    create table vc ( c0 int IDENTITY(1,1) NOT NULL, c1 datetime, primary key (c0))
  2. Next, we tried to run one of the INSERT statements shown above, but got the ORA-02070 error. To work around this, we passed the contents of the function into a data store and then passed the data store to the INSERT statement. For example:
    DECLARE
    d1 date;
    BEGIN
    select sysdate into d1 from dual;
    INSERT INTO vc@odbc ("c1") values (d1);
    END;/
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from vc@odbc;
    
            c0 c1
    ---------- ---------
             1 03-MAR-14
    

Further information