
DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test; 

CREATE TABLE `test_table` (
  `nId` int(11) NOT NULL AUTO_INCREMENT,
  `strText` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
  `strTextExtended` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`nId`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=ascii;

INSERT INTO `test_table` (`strText`) VALUES('test 1');
INSERT INTO `test_table` (`strText`) VALUES('test 2');
INSERT INTO `test_table` (`strText`) VALUES('test 3');
INSERT INTO `test_table` (`strText`) VALUES('test 4');
INSERT INTO `test_table` (`strText`) VALUES('test 5');
INSERT INTO `test_table` (`strText`) VALUES('test 6');
INSERT INTO `test_table` (`strText`) VALUES('test 7');
INSERT INTO `test_table` (`strText`) VALUES('test 8');
INSERT INTO `test_table` (`strText`) VALUES('test 9');

DROP PROCEDURE IF EXISTS `READ_PROCEDURE`;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `READ_PROCEDURE`()
BEGIN
	IF EXISTS( SELECT * FROM `test_table` )  THEN
		SELECT * FROM `test_table`;
	ELSE
		SELECT 'there is nothing';
	END IF;
END $$
DELIMITER ;
