Check the status of the database server

Some interactions with the database server cannot execute unless the database server is idle. Other actions assume that the database server is busy processing a request. You can check whether the database server is currently processing an SQL request with the sqldone() function. This function returns 0 if the database server is idle and a negative value if it is busy.