Ian_Hill

CA Tuesday Tip: (CA IDMS) Pseudo column ROWID

Discussion created by Ian_Hill Employee on Dec 18, 2012
CA IDMS Tuesday Tip by Ian Hill, Principal Support Engineer for December 18, 2012.

Following on from last week's topic of the pseudo table, this week we move on to the pseudo column, ROWID.

ROWID is a pseudo column available to each table. The value is the dbkey of the underlying database record.

Note that it is related to the table, not the result set of a query. Therefore, when more than one table is specified in a query, you must indicate which table a ROWID refers to.

For example:-

[font=Courier New]SELECT E.ROWID AS EMP_ROWID, D.ROWID AS DEPT_ROWID,
E.EMP_LAST_NAME_0415, D.DEPT_ID_0410
FROM EMPNET1.EMPLOYEE E, EMPNET1.DEPARTMENT D
WHERE "DEPT-EMPLOYEE"
AND E.EMP_LAST_NAME_0415 LIKE 'A%';
*+                                                               
*+    EMP_ROWID    DEPT_ROWID  EMP_LAST_NAME_0415  DEPT_ID_0410  
*+    ---------    ----------  ------------------  ------------  
*+  X'01250F01'   X'0125A209'  ANGELO                      4000  
*+  X'01250F02'   X'0125A404'  AMERICANO                    100  
*+  X'01251102'   X'01259609'  ANDALE                      5100  
*+  X'01252202'   X'01259609'  ARM                         5100  
*+                                                               
*+ 4 rows processed                                               [font]

In the above example, EMP_ROWID is the dbkey of the EMPLOYEE record, and DEPT_ROWID is the dbkey of the DEPARTMENT. Note that in the last two rows, DEPT_ROWID is the same because they both come from the department with DEPT_ID_0410 equal to 5100.

Next Tuesday is December 25 the following one in January 1 - both holidays, so the next Tip won't be until January 8.

Tuesday Tips would like to wish all our readers the very best for the holiday season and a happy New Year.

Outcomes