title: Date comparison using >= , < ,> or even between not working within mysql stored procedure but work ouside as individual queries
body: <pre><code>/*Table structure for table `testtable` */
  
  DROP TABLE IF EXISTS `testtable`;
  
  CREATE TABLE `testtable` (
    `tid` bigint(20) unsigned NOT NULL auto_increment,
    `tcode` bigint(20) default NULL,
    `tname` varchar(50) default NULL,
    `tdate` date default NULL,
    `ttime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
    `tnumeric` decimal(10,2) default NULL,
    `tdecimal` decimal(8,2) default NULL,
    PRIMARY KEY  (`tid`)
  ) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=latin1;
  
  /*Data for the table `testtable` */
  
  insert  into `testtable`(`tid`,`tcode`,`tname`,`tdate`,`ttime`,`tnumeric`,`tdecimal`) values (100,80,'test name text1','2012-11-03','2012-11-03 00:00:00','123.23','456.23'),(101,81,'test name text2','2012-11-04','2012-11-04 00:00:00','78.23','456.23'),(102,82,'test name text3','2012-11-05','2012-11-05 00:00:00','456.23','456.23'),(103,83,'test name text4','2012-11-06','2012-11-06 00:00:00','81.23','456.23'),(104,84,'test name text5','2012-11-20','2013-03-20 16:13:25','333.23','456.23'),(105,84,'test name text5','2012-11-15','2013-04-09 18:45:21','333.23','456.23'),(106,84,'test name text5','2013-03-01','2013-03-20 16:16:11','333.23','456.23'),(107,84,'test name text5','2012-11-10','2013-03-20 16:13:14','333.23','456.23'),(108,84,'test name text5','2012-11-07','2012-11-07 00:00:00','0.00','456.23'),(109,84,'test name text5','2012-11-22','2013-03-20 16:16:02','333.23','0.00');
  
  
  ----------------------------------------------------------------------------------------
  
  CREATE DEFINER=`root`@`localhost` PROCEDURE `testProc`(
  IN tdate VARCHAR(15)
  
  )
  BEGIN
      DECLARE a,b,c DECIMAL(10,2);
  
      -- SELECT * FROM `testtable` WHERE `tdate` &gt;='2012-11-06';
      -- SELECT * FROM `testtable` WHERE `tdate` between STR_TO_DATE('06/11/2012', '%d/%m/%Y') and STR_TO_DATE('30/11/2012', '%d/%m/%Y');
      -- SELECT * FROM `testtable` WHERE `tdate` &lt; STR_TO_DATE('2012-11-06', '%Y-%d-%m');
  
      SELECT * FROM `testtable` WHERE `tdate` &lt; tdate;
  
      -- select STR_TO_DATE(tdate, '%d/%m/%Y');
      -- select * from `testtable`;
  
      END$$
  </code></pre>