ChkDB |
Open Source Rule-Based Data Checking |
|
Home Contact Download Releases Open Source License Project Contributing The PL/SQL Using ChkDB Installation Read-Me Rule-Sets ChkDB Tables E-R Diagram
Tiny Sample External Links Data Quality and Data Profiling (a glossary) |
Implement a Data DomainThis is the sample_implement.sql file that comes with a ChkDB distribution (without the license section). If you wanted to use the sample rule-set to check your Human Resources database, this is what you would setup...
-- ==============================================================
-- ChkDB - Sample Implementation of domain: CHKDB_SAMP_HR
--
-- Setup the tables/views in the CHKDB_SAMP_HR data domain.
-- In this case, we are defining views into the sample
-- database that match the table definitions in the domain.
--
-- Alternatively, we could have created the tables defined
-- in the domain and populate them from the database prior
-- to running checks.
--
-- This is an example of the work that must be done to use
-- ChkDB domains and rule-sets for a particular database.
--
-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-- Implement the domain as views into the database.
-- = = = = = = = = = = = = = = = = = = = = =
-- Departments
create view CHKDB_SAMP_HR_DEPT
as select DEPT_NAME "DEPT_ID",
DEPT_NAME "DEPT_NAME",
MANAGER "MANAGER",
FLOOR "FLOOR",
BUDGET_AMT "BUDGET_AMT",
BUDGET_APPRV "BUDGET_APPRV",
BUDGET_EST "BUDGET_EST"
from CHKDB_SAMP_DEPT;
-- Note: the sample department table does not have
-- separate id and name fields, so name is used for both.
-- = = = = = = = = = = = = = = = = = = = = =
-- Groups in a Department.
create view CHKDB_SAMP_HR_GROUP
as select DEPT_NAME "DEPT_ID",
GROUP_NAME "GROUP_ID",
GROUP_NAME "GROUP_NAME",
ACTIVE_YN "ACTIVE_YN",
LONG_NAME "GROUP_DESC"
from CHKDB_SAMP_GROUP;
-- Note: the sample department table does not have
-- separate id and name fields, so name is used for both.
-- = = = = = = = = = = = = = = = = = = = = =
-- Employees
create view CHKDB_SAMP_HR_EMP
as select EMPL_ID "EMP_ID",
EMPL_NAME "EMP_NAME",
DEPT_NAME "DEPT_ID",
GROUP_NAME "GROUP_ID",
POSITION "POSITION",
HIRE_DATE "HIRE_DT",
LAST_REVIEW "LAST_REVIEW_DT",
PROBATION_ENDS "PROBATION_END_DT",
VACN_DAYS "VACN_DAYS_TOT",
VACN_USED "VACN_DAYS_USED"
from CHKDB_SAMP_EMPL;
-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|