CREATE OR REPLACE FUNCTION food600.getidspravaslave(
	idspravamaster integer)
    RETURNS character varying
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE
AS $BODY$
DECLARE 
idsprava INTEGER;
BEGIN
SELECT id_sprava INTO idsprava FROM food600.spravy WHERE id_sprava_master=idspravamaster;
RETURN btrim(idsprava::character(20));
END;
$BODY$;
