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 :
- metric_id can be fetched by using the page - CAST Engineering Dashboard - Information - How to get the ID of a Quality Rule
- 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
- 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
| Release | Yes/No |
|---|---|
| 8.3.x | ✅ |
| 8.2.x | ✅ |
| 8.1.x | ✅ |
| 8.0.x | ✅ |
Applicable RDBMS
| RDBMS | Yes/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