CURRENT DBPARTITIONNUM special register
The CURRENT DBPARTITIONNUM special register specifies an INTEGER value that identifies the coordinator database partition number for the statement.
For statements issued from an application, the coordinator is the database partition number to which the application connects.
For statements issued from a routine, the coordinator is the database partition number from which the routine is invoked.
When used in an SQL statement inside a routine, CURRENT DBPARTITIONNUM is never inherited from the invoking statement.
Example 1: Set the host variable APPL_DBPNUM (integer) to the number of the database partition to which the application is connected.
VALUES CURRENT DBPARTITIONNUM INTO :APPL_DBPNUM
Example 2: The following command is issued on member 0 and on a 4 member system in a partitioned database environment. This query will retrieve the currently connected database partition number.
VALUES CURRENT DBPARTITIONNUM 1 ----------- 0