ROWID columns
Informix®
When creating a table, Informix automatically adds a
ROWID
integer column (applies to non-fragmented tables only).
The ROWID
column is auto-filled with a unique number and can be used like a
primary key to access a given row.
ROWID
usage was a common practice in the early days of Informix 4GL programming. Today it is
recommended to define all your database tables with a PRIMARY
KEY
to uniquely identify rows.With Informix, the SQLCA.SQLERRD[6]
register contains the ROWID
of the last modified row.
ORACLE
Oracle® supports ROWIDs, but the data
type is different from Informix ROWIDs: Oracle rowids are
CHAR(18)
.
AAAA8mAALAAAAQkAAA
Since Oracle rowids are physical
addresses, they cannot be used as permanent row identifiers ( After a DELETE
, an
INSERT
statement might reuse the physical place of the deleted row, to store the
new row ).
Solution
If the BDL application uses Informix ROWIDs, it is
recommended that the program logic is reviewed in order to use the real primary keys instead
(usually, serials which can be supported), or Oracle rowids as CHAR(18)
( Informix rowids will fit in this char data type).
If you cannot avoid using rowids, you must change the type of variables which hold
ROWID
values. Instead of using INTEGER
, you must use
CHAR(18)
. Informix rowids (integers)
will automatically fit into a CHAR(18)
variable.
All references to SQLCA.SQLERRD[6]
must be removed because this variable will
not contain the ROWID of the last modified row when using the Oracle interface.
ROWID
keyword
translation can be controlled with the following FGLPROFILE
entry:dbi.database.dsname.ifxemul.rowid = { true | false }
For more details see IBM Informix emulation parameters in FGLPROFILE.