我在mysql中有一个简单的数据库,如下所示:
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 行
我真的很困惑,如果这是一个愚蠢的错误,请原谅我,但我已经经历了很多问题,但没有看到任何与此相关的问题。