DELIMITER $$
/**
 * compute aging balance
 *
 * @author Armen
 */ 
Drop Function if Exists AMO_BAL_REFDATE $$
CREATE Function `AMO_BAL_REFDATE` () Returns Date
BEGIN
	Return Coalesce(@AMO_BAL_DATE_DEFAULT, curdate());
END$$
Delimiter ;