DO $$
DECLARE
    entid INT;
BEGIN
    SELECT EntityID INTO entid 
    FROM VCLib.T_ENTITIES 
    WHERE EntName = 'FPUMP_DICT_STC_INDICATOR_СODE';

    DELETE FROM VCLib.T_ENTITIES_ATTRIBUTES
    WHERE EntityID = entid;

    DELETE FROM VCLib.T_ENTITIES 
    WHERE EntityID = entid;
END $$;