connection-id
An integer, usually returned from a previous call to NEXT_CONNECTION. If connection-id is NULL, NEXT_CONNECTION returns the most recent connection ID.
database-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 if you want to disconnect 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. If you want
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.