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.
CURRENT DBPARTITIONNUM returns 0 if the database instance is not defined to support database partitioning. For a partitioned database, the db2nodes.cfg file exists and contains database partition and database partition number definitions.
In a database partitioning environment, the CURRENT DBPARTITIONNUM special register can be changed through the CONNECT statement, but only under certain conditions.
Examples
VALUES CURRENT DBPARTITIONNUM
INTO :APPL_DBPNUM
VALUES CURRENT DBPARTITIONNUM
1
-----------
0