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