DO $$
DECLARE 
    t int;
BEGIN
    t := (SELECT EntityID FROM VCLib.T_ENTITIES WHERE EntName = 'USER_SEARCHES' AND "schema" = 'VCLib');
    
    UPDATE VCLib.T_USER_SEARCHES
    SET type_ = t;
END $$;