該函數返回NULL: CREATE FUNCTION `GetCardID`(numId INT) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE retcard INT(11);
SELECT id
INTO retcard
FROM cards
WHERE `number` = numId
我想編寫一個程序: CREATE PROCEDURE `addByType`(IN myDate DATETIME, IN myType INT, OUT output DATETIME)
BEGIN
DECLARE unit ?;
CASE
WHEN myType = 1 THEN
SET unit = HOUR;
WHEN myType = 2 THE
如果我多次調用一個函數,那麼它會每次執行還是隻執行一次,然後會在幾次之後使用該值? 例子: select my_function('filed'),my_function('filed')/field2,
(my_function('filed')*field1)/field3,
...... from my_table where group by filed1;
是my_fu