DB2 Scalar functions - RID and RID_BIT
The RID and RID_BIT functions are used to uniquely identify a row. Each returns the row identifier (RID) of a row. The result of the RID_BIT function, unlike the result of the RID function, contains table information to help you avoid inadvertently using it with the wrong table. Both functions are non-deterministic.
The schema is SYSIBM. The function name cannot be specified as a qualified name.
Notes
CREATE VIEW
If a table designator is not specified, the FROM clause must contain only one element which can be derived to be the table designator (SQL STATE 42703).
The data type of the result is either BIGINT (for RID) or VARCHAR (16) FOR BIT DATA (for RID_BIT). The result can be null.
The RID or RID_BIT function might return different values when invoked several times for a single row. For example, if RID or RID_BIT is run both before and after the reorg utility is run against the specified table, the function might return a different value each time.
ROWID
SELECT RID_BIT (EMPLOYEE) , ROW CHANGE TOKEN FOR EMPLOYEE , LASTNAME FROM EMPLOYEE WHERE DEPTNO = '20'
CREATE TABLE EMP1 ( EMPNO CHAR(6), NAME CHAR(30), SALARY DECIMAL(9,2), PICTURE BLOB(250K), RESUME CLOB(32K))
SELECT RID_BIT(EMP1) , ROW CHANGE TOKEN FOR EMP1 INTO :HV_EMP_RID , :HV_EMP_RCT FROM EMP1 WHERE EMPNO = '3500'
UPDATE EMP1 SET SALARY = SALARY + 1000 , RESUME = UPDATE_RESUME(:HV_RESUME) WHERE RID_BIT(EMP1) = :HV_EMP_RID AND ROW CHANGE TOKEN FOR EMP1 = :HV_EMP_RCT