CREATE OR REPLACE FUNCTION food600.getidptypkmastermaster(
	idptypk integer)
    RETURNS character varying
    LANGUAGE 'plpgsql'

    COST 100
    VOLATILE 
    
AS $BODY$
DECLARE idptypkmaster INTEGER;
BEGIN
SELECT idriadok_master INTO idptypkmaster FROM kredit.hk_ptypk WHERE idriadok=idptypk;
RETURN btrim(idptypkmaster::character(20));
END
$BODY$;
