CREATE OR REPLACE FUNCTION food600.getidhoresslave(
	idhoresmaster integer)
    RETURNS character varying
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE
AS $BODY$
DECLARE 
idhores INTEGER;
BEGIN
SELECT idriadok INTO idhores FROM food600.hores_d WHERE idriadok_master=idhoresmaster;
RETURN btrim(idhores::character(20));
END;
$BODY$;
