1
我有一個簡單的數據庫,在MySQL如下:SELECT裏面存儲的過程無法正常工作,而外面確實
DROP TABLE IF EXISTS MEDIAVEND.ITEMDETAILS;
CREATE TABLE IF NOT EXISTS MEDIAVEND.ITEMDETAILS (
ItemID BIGINT UNSIGNED NOT NULL,
ITEMTYPE ENUM('MUSIC', 'MOVIE', 'GAME') NOT NULL,
ITEMMEDIATYPE ENUM('CD', 'DVD', 'BLURAY') NOT NULL,
ITEMNAME CHAR(100) NOT NULL,
ITEMDESCRIPTION CHAR(200) NOT NULL,
ITEMCOUNT BIGINT NOT NULL,
MACHINEID BIGINT NOT NULL,
PRIMARY KEY (ITEMID)
);
INSERT INTO MEDIAVEND.ITEMDETAILS VALUES
(1,'MUSIC','CD','ALBUM 1','SOME DESCRIPTION OF 1',100,1),
(2,'MUSIC','CD','ALBUM 2','SOME DESCRIPTION OF 2',20,1),
(3,'MOVIE','DVD','MOVIE 1','SOME DESCRIPTION OF 1',30,1),
(4,'MOVIE','BLURAY','MOVIE 2','SOME DESCRIPTION OF 2',40,1),
(5,'GAME','DVD','GAME 1','SOME DESCRIPTION OF 1',50,1),
(6,'GAME','BLURAY','GAME 2','SOME DESCRIPTION OF 2',60,1);
和存儲過程爲:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `info_ItemType`(in itemType char(10))
BEGIN
SELECT * FROM MEDIAVEND.ITEMDETAILS WHERE ITEMTYPE= itemType;
END
所以,當我打電話以下我看到不同的結果。
select * from mediavend.itemdetails where itemType='MUSIC';
- 2行返回
call mediavend.info_ItemType('MUSIC');
- 6行返回
我真的很困惑,原諒我,如果這是一個愚蠢的錯誤,但我已經通過很多的問題了並沒有看到任何與此相關的內容。
哇,大小寫敏感!永遠不會忘記關於mysql。謝謝。 – SK1 2013-05-13 17:40:58