/* GET THE VALUE OF A MISC ENTRY (PROVIDED THE TARGET AND KEY) */
/* =============================================================================================================== */
DROP FUNCTION IF EXISTS GET_MED_BUDDY_EMAIL;
COMMIT;

DELIMITER //

CREATE FUNCTION `GET_MED_BUDDY_EMAIL`(`p_id` VARCHAR(36))
RETURNS VARCHAR(255)
BEGIN

  DECLARE vBuddyEmail INT;

  SELECT `email` 
  FROM `MedBuddies`
  WHERE `_id` = p_id
  INTO vBuddyEmail;
	
	RETURN vBuddyEmail;

END 
//
COMMIT //

DELIMITER ;
