SQL Queries - CAST Central Base - Queries on Objects - How to check if an object is violated by a quality rule

Purpose of Query

The query check if an object is violated by a quality rule. To execute the query you need to get the following entries :

  1. metric_id can be fetched by using the page - CAST Engineering Dashboard - Information - How to get the ID of a Quality Rule
  2. snapshot_id can be fetched by using the page - SQL Queries - CAST Central Base - Queries on snapshots - How to get the ID and name of a snapshot for a given application
  3. object_id can be fetched by using the page - SQL Queries - CAST Central Base - Queries on Objects - How to get the ID of an object

Applicable CAST Version

ReleaseYes/No
8.3.x
8.2.x
8.1.x
8.0.x

Applicable RDBMS

RDBMSYes/No
Oracle Server
Microsoft SQL Server
CSS2

Query for CSS

SELECT EXISTS (SELECT 1 
               FROM   dss_metric_results 
               WHERE  metric_id = <metric_id> + 1 
                      AND snapshot_id = <snapshot_id> 
                      AND object_id = <object_id>)

Query result example

t

Query result interpretation

The query returns “t” if the object is violated else it returns “f”

Query for Oracle

SELECT EXISTS (SELECT 1 
               FROM   dss_metric_results 
               WHERE  metric_id = <metric_id> + 1 
                      AND snapshot_id = <snapshot_id> 
                      AND object_id = <object_id>)

Query result example

t

Query result interpretation

The query returns “t” if the object is violated else it returns “f”

Query for SQL server

SELECT EXISTS (SELECT 1 
               FROM   dss_metric_results 
               WHERE  metric_id = <metric_id> + 1 
                      AND snapshot_id = <snapshot_id> 
                      AND object_id = <object_id>)

Query result example

t

Query result interpretation

The query returns “t” if the object is violated else it returns “f”

Notes/comments

Related Pages