#-- 10. Cursor can fetch empty strings. delimiter //; --disable_warnings drop procedure if exists p1// drop table if exists t1// --enable_warnings create table t1 (col1 VARCHAR(255) not null)// insert into t1 values('')// create procedure p1() sql security invoker begin declare v1 VARCHAR(255); declare xx cursor for select col1 from t1; open xx; fetch xx into v1; select v1; end // call p1()// -- should return 1 row, with '' (an empty string) drop procedure p1// drop table t1// ## What about CHAR ? Bug --disable_warnings drop procedure if exists p1// drop table if exists t1// --enable_warnings create table t1 (col1 CHAR(10) not null)// insert into t1 values('')// create procedure p1() sql security invoker begin declare v1 CHAR(10); declare xx cursor for select col1 from t1; open xx; fetch xx into v1; select v1; end // call p1()// -- should return 1 row, with '' (an empty string) drop procedure p1// drop table t1// ## What about TEXT ? Bug --disable_warnings drop procedure if exists p1// drop table if exists t1// --enable_warnings create table t1 (col1 TEXT)// insert into t1 values('')// create procedure p1() sql security invoker begin declare v1 TEXT; declare xx cursor for select col1 from t1; open xx; fetch xx into v1; select v1; end // call p1()// -- should return 1 row, with '' (an empty string) drop procedure p1// drop table t1// ## What about BLOB ? Bug --disable_warnings drop procedure if exists p1// drop table if exists t1// --enable_warnings create table t1 (col1 BLOB)// insert into t1 values('')// create procedure p1() sql security invoker begin declare v1 BLOB; declare xx cursor for select col1 from t1; open xx; fetch xx into v1; select v1; end // call p1()// -- should return 1 row, with '' (an empty string) drop procedure p1// drop table t1// ## What about BIGINT and the magic value 0 ? No bug --disable_warnings drop procedure if exists p1// drop table if exists t1// --enable_warnings create table t1 (col1 BIGINT not null)// insert into t1 values(0)// create procedure p1() sql security invoker begin declare v1 BIGINT; declare xx cursor for select col1 from t1; open xx; fetch xx into v1; select v1; end // call p1()// -- should return 1 row, with 0 drop procedure p1// drop table t1// ## Is it a problem of the stored procedure variables ? No --disable_warnings drop procedure if exists p1// drop table if exists t1// --enable_warnings create table t1 (col1 varchar(255) not null)// insert into t1 values('')// create procedure p1() sql security invoker begin declare v1 varchar(255); declare xx cursor for select col1 from t1; open xx; fetch xx into v1; set @x= v1; end // call p1()// select @x// -- should return 1 row, with '' (an empty string) drop procedure p1// drop table t1//