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

DELIMITER //

CREATE FUNCTION `GET_MISC_VALUE`(`p_target` VARCHAR(75), `p_key` VARCHAR(75))
RETURNS INT
BEGIN

  DECLARE iMiscValue INT;

  SELECT `value` 
  FROM `Misc`
  WHERE `target` = p_target
  AND `key` = p_key
  INTO iMiscValue;
	
	RETURN iMiscValue;

END 
//
COMMIT //

DELIMITER ;
