 /
 ALTER TABLE KRMS_ACTN_ATTR_T DISABLE CONSTRAINT KRMS_ACTN_ATTR_FK2
 /
-DELETE FROM KRMS_ACTN_ATTR_T WHERE ACTN_ID in ( select actn_id from krms_actn_t where RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') ) )
-/
-DELETE FROM KRMS_ACTN_T WHERE RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') )
+DELETE FROM KRMS_ACTN_ATTR_T WHERE ACTN_ID in ( select actn_id from krms_actn_t where RULE_ID in ( SELECT RULE_ID FROM KRMS_ACTN_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') ) )
+/
+DELETE FROM KRMS_ACTN_T WHERE RULE_ID in ( SELECT RULE_ID FROM KRMS_ACTN_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') )
 /
 DECLARE
 	cursor c_data is
 	SELECT a.ACTN_ID,a.RULE_ID FROM KRMS_ACTN_T@KC_STAG_DB_LINK a
-	WHERE a.RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') );
+	WHERE a.RULE_ID in ( SELECT RULE_ID FROM KRMS_ACTN_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') );
 	r_data c_data%rowtype;
 	ls_seq KRMS_ACTN_T.ACTN_ID%type;
 

ALTER TABLE KRMS_RULE_T DISABLE CONSTRAINT KRMS_RULE_FK1
/
---------------------------
DELETE FROM KRMS_CMPND_PROP_PROPS_T WHERE PROP_ID in (  SELECT PROP_ID FROM KRMS_PROP_T WHERE RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') ) )
/
DELETE FROM KRMS_PROP_PARM_T WHERE PROP_ID in ( SELECT PROP_ID FROM KRMS_PROP_T WHERE RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') ) )
/
DELETE FROM KRMS_PROP_T WHERE RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') )
/
DELETE FROM KRMS_RULE_ATTR_T WHERE RULE_ID in ( SELECT RULE_ID FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') )
/
DELETE FROM KRMS_RULE_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow')
/
drop table TEMP_MAPPING_KRMS_RULE_T
/


DECLARE
	cursor c_data is
	SELECT PROP_ID,RULE_ID FROM KRMS_PROP_T@KC_STAG_DB_LINK	
	WHERE RULE_ID IN ( SELECT RULE_ID FROM KRMS_ACTN_T WHERE typ_id IN ( SELECT typ_id FROM krms_typ_t WHERE nm = 'Route to PeopleFlow') );
	r_data c_data%rowtype;
	ls_seq KRMS_PROP_T.PROP_ID%type;

