delete FROM t_brm_policy_l WHERE fid IN (select fid FROM t_brm_policy WHERE fnumber IN ('HOMSTR_CERTIFICATE_MAIN'));
delete FROM t_brm_policy_his_l  where fid in (select fid from t_brm_policy_his  where fpolicyid in (select fid FROM t_brm_policy WHERE fnumber IN ('HOMSTR_CERTIFICATE_MAIN')));
delete FROM t_brm_policy_his  where fpolicyid in (select fid FROM t_brm_policy WHERE fnumber IN ('HOMSTR_CERTIFICATE_MAIN'));
delete FROM t_brm_policy WHERE fnumber IN ('HOMSTR_CERTIFICATE_MAIN');

DELETE FROM T_BRM_SCENEINPUT_L WHERE fentryid in (select fentryid FROM T_BRM_SCENEINPUT WHERE fid in (select fid FROM T_BRM_SCENE WHERE fnumber in ('HOMSCE_CERTIFICATE_MAIN')));
DELETE FROM T_BRM_SCENEOUTPUT_L WHERE fentryid in (select fentryid FROM T_BRM_SCENEOUTPUT WHERE fid in (select fid FROM T_BRM_SCENE WHERE fnumber in ('HOMSCE_CERTIFICATE_MAIN')));
DELETE FROM T_BRM_SCENEINPUT WHERE fid in (select fid FROM T_BRM_SCENE WHERE fnumber in ('HOMSCE_CERTIFICATE_MAIN'));
DELETE FROM T_BRM_SCENEOUTPUT WHERE fid in (select fid FROM T_BRM_SCENE WHERE fnumber in ('HOMSCE_CERTIFICATE_MAIN'));
DELETE FROM T_BRM_SCENE_L WHERE fid in (select fid FROM T_BRM_SCENE WHERE fnumber in ('HOMSCE_CERTIFICATE_MAIN'));
DELETE FROM T_BRM_SCENE WHERE fnumber in ('HOMSCE_CERTIFICATE_MAIN');
