DELIMITER $$

CREATE FUNCTION  pbi_is_not_empty
(
  string VARCHAR(10240) CHARSET UTF8
)
RETURNS BOOLEAN
DETERMINISTIC
READS SQL DATA
BEGIN
  RETURN NULLIF(string,'') IS NOT NULL;
END;$$


CREATE FUNCTION  pbi_generate_entity_key 
(
  id INT(11),
  prefix VARCHAR(10)
)
RETURNS VARCHAR(18) CHARSET UTF8  
DETERMINISTIC
READS SQL DATA
BEGIN
  RETURN CONCAT(prefix, LPAD(id, 8, '0'));
END;$$
