Home > database >  Questions about mysql functions
Questions about mysql functions

Time:10-01

This is the cc function
The BEGIN
Declare sReturn int (1) the DEFAULT 0;
Select the state into sReturn the from SSS where aperiod like left (date_, 7);
If (sReturn=1 or sReturn=3) then
return 1; # can modify, delete and add
The else
Return 2; # do not modify, delete, add
end if;
# return sReturn;
END

Select the cc (null) can correct to arrive at a value of 2
Select the cc (" ") can also be concluded that a value of 2

But the select cc (time) from zz where id=2
The id=2 time field is empty when the query has a value of empty
The id=2 time slots for query out when he is not null values right

Don't quite understand


CodePudding user response:

Provide a complete reproduce scripts
The information given you couldn't see what's the problem

CodePudding user response:

Zz table there is a date field, I put out date in the function to run the select cc (time) from zz where id=2, if zz. Time has value can get the desired results, if there is no value there will be no results,
But select cc (null) | | select cc (" ") and have the result, I just don't understand, zz. Time="" or. Zz. Time is null, use the select cc (zz. Time) and select the cc (null) | | select cc what is the difference between (" "), why are they different results
  • Related