Checking Database Consistency
Page 2 of 4

The checkTable Method

The method checkTable in the class COM.cloudscape.database.ConsistencyChecker checks the consistency of a Cloudscape table. (The class is aliased as ConsistencyChecker.) You run this method in an SQL-J statement, like this:

VALUES ConsistencyChecker.checkTable(
    SchemaName, TableName)

checkTable returns a boolean. If the table is consistent (or if checkTable is run on a view), checkTable returns true. Otherwise, checkTable throws an exception on the first inconsistency it finds.

checkTable verifies the following:

  • Heaps are internally consistent.
  • Heaps and all associated indexes contain the same number of rows.
  • The values and row locations in each index match those of the heap.
  • All BTREE indexes are internally consistent.

NOTE: Both SchemaName and TableName must be any expression that evaluates to a string data type. If you created a schema or table name as a non-delimited identifier, you must present their names in all upper case. For example:

VALUES ConsistencyChecker.checkTable('APP', 'CITIES')

For a consistent table, the following result is displayed:

SQLC&
-----
true

1 row selected