View slot9.WORLD.TSTA.ZZC1_NIBRS_CRIME_TARGETS
Legend:
Primary key columns
Columns with indexes
Implied relationships
Excluded column relationships
< n > number of related tables
 
Column Type Size Nulls Auto Default Children Parents Comments
AUDIT_TIMESTAMP date 7  √  null
AUDIT_TRANSACTION_TYPE varchar2 1  √  null
AUDIT_USER_NAME varchar2 100  √  null
NIBRS_CODE varchar2 30  √  null
NIBRS_CODES.NIBRS_CODE Implied Constraint R
CRIME_AGAINST_CODE varchar2 30  √  null
REC_ID number 0  √  null

Analyzed at Mon Sep 20 21:05 MDT 2021

View Definition:
with t as (SELECT ZZ1.AUDIT_TIMESTAMP AUDIT_TIMESTAMP, ZZ1.AUDIT_TRANSACTION_TYPE AUDIT_TRANSACTION_TYPE, ZZ1.AUDIT_USER_NAME AUDIT_USER_NAME, ZZ1.AUDIT_TRUE_NULLS AUDIT_TRUE_NULLS, ZZ1.NIBRS_CODE NIBRS_CODE, ZZ1.CRIME_AGAINST_CODE CRIME_AGAINST_CODE, ZZ1.REC_ID REC_ID FROM ZZ_NIBRS_CRIME_TARGETS ZZ1 union all select sysdate, 'C', null, null, ZZ2.NIBRS_CODE, ZZ2.CRIME_AGAINST_CODE, ZZ2.REC_ID FROM NIBRS_CRIME_TARGETS ZZ2 where exists ( select * from ZZ_NIBRS_CRIME_TARGETS where NIBRS_CODE= ZZ2.NIBRS_CODE AND CRIME_AGAINST_CODE= ZZ2.CRIME_AGAINST_CODE )) select AUDIT_TIMESTAMP, AUDIT_TRANSACTION_TYPE, AUDIT_USER_NAME, NIBRS_CODE, CRIME_AGAINST_CODE, REC_ID from ( select AUDIT_TIMESTAMP, AUDIT_TRANSACTION_TYPE, AUDIT_USER_NAME, NIBRS_CODE, CRIME_AGAINST_CODE,( CASE WHEN audit_transaction_type in ( 'C','D') then REC_ID ELSE (CASE WHEN NVL(SUBSTR(lead(AUDIT_TRUE_NULLS) over (partition by NIBRS_CODE,CRIME_AGAINST_CODE order by audit_timestamp asc),7,1),'N') ='N' THEN lead(REC_ID ignore nulls) over (partition by NIBRS_CODE,CRIME_AGAINST_CODE order by audit_timestamp asc) END) END) REC_ID,row_number() over (partition by NIBRS_CODE,CRIME_AGAINST_CODE order by audit_timestamp asc) as rn from t )
 
Possibly Referenced Tables/Views:


Close relationships: