An integer, usually returned from a previous call to NEXT_CONNECTION. If connection-id is NULL, NEXT_CONNECTION returns the most recent connection ID.
An integer representing one of the databases on the current server. If you supply no database-id, the current database is used. If you supply NULL, then NEXT_CONNECTION returns the next connection regardless of database.
NEXT_CONNECTION can be used to enumerate the connections to a database. Connection IDs are generally created in monotonically
increasing order. This function returns the next connection ID in reverse order.
To get the connection ID value for the most recent connection, enter NULL as the connection-id. To get the subsequent connection, enter the previous return value. The function returns NULL when there are no more connections
in the order.
NEXT_CONNECTION is useful for disconnecting all the connections created before a specific time. However, because NEXT_CONNECTION
returns the connection IDs in reverse order, connections made after the function is started are not returned. To ensure that
all connections are disconnected, prevent new connections from being created before you run NEXT_CONNECTION.
Cloud note: Because of tenant database isolation rules, when this function is called in the cloud it returns only information about the
current tenant database.
No privileges are required to execute this function to return the current connection ID. To execute this function for other
connections, you must have either the SERVER OPERATOR, MONITOR, or DROP CONNECTION system privilege.