9.29.1.Updating through Inverses

A view that selects calls to functions, which have inverses, is updateable. This means that the SQL compiler will use the inverse function on the value being assigned before assigning the column. This is done for both insert and update operations. No special declaration is needed. If the function with inverse has multiple arguments, all of which are columns, then assigning the function will assign all the argument columns, having called the appropriate inverse for getting each of the separate argument values.

For example:

SQL> insert into orders_2 (o_iid) values (1102000000003);

Done. -- 1 msec.
SQL> select * from orders_2 where o_w_id = 11;
O_IID            O_C_IID          O_ID              O_D_ID            O_W_ID            O_C_ID      O_ENTRY_D   O_CARRIER_ID  O_OL_CNT    O_ALL_LOCAL
DECIMAL          DECIMAL          INTEGER NOT NULL  INTEGER NOT NULL  INTEGER NOT NULL  INTEGER     DATE        INTEGER     INTEGER     INTEGER
_______________________________________________________________________________

1102000000003    NULL             3                 2                 11                NULL        NULL        NULL        NULL        NULL

1 Rows. -- 1 msec.
SQL> update item_euro set i_price = 120 where i_id = 1234;
[Note] Conclusions

The examples in this document used tables attached from remote databases because the features discussed here are most likely to be useful in such contexts. Also the query execution plans clearly show which operations take place where. The inverse function mechanism is however in no way limited to virtual database applications. All the examples will work equally well with local tables.