Checking For Number of Rows Returned by an SQL Query


First, we will implement the check for the number of stored procedures that there are under the 'DB2AUTH' schema. To do this, we need to look at the SYSCAT.PROCEDURES table, to see how many rows have 'DB2AUTH' in the 'PROCSCHEMA' column.

We need an actionScript to perform this check. While we perform the action, we don't want the user to click any other buttons. So, we set the attribute 'lockScreen' to 'true. To review actionScripts, refer back to '5. actions' of this tutorial.

Steps:

  1. Open the file 'menu_30_Db2authLab.xml' in an editor
  2. Copy or enter the text from the right into the file
  3. Don't forget the closing actionScript tag at the end of the page!
  4. Keep the file open


You will notice that there are four parameters:

This action performs the query, 'SELECT COUNT(*) FROM SYSCAT.PROCEDURES WHERE PROCSCHEMA = 'DB2AUTH'
The action will return true if there are 7 or more rows returned, and false otherwise.