我试图在 MySQL 5.5 中调用插入存储过程。我使用的存储过程是:
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `SetProvince`(
IN p_Code VARCHAR(20),
IN p_Name VARCHAR(200),
IN p_CountryID INT(11),
IN p_Description TEXT,
IN p_IsActive BIT(1),
IN p_CreationDatestamp CHAR(8)
)
BEGIN
INSERT INTO province
(
`Code`,
`Name`,
`CountryID`,
`Description`,
`IsActive`,
`CreationDatestamp`
)
VALUES
(
@p_Code,
@p_Name,
@p_CountryID,
@p_Description,
@p_IsActive,
@p_CreationDatestamp
);
END;
但是每当我将存储过程称为:
CALL SetProvince('0003','Assam',1,'hehehehehe',1,'20130607');
它在所有列中插入 NULL。我在哪里错了?
表结构为:
CREATE TABLE `province` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Code` varchar(20) DEFAULT NULL,
`Name` varchar(200) DEFAULT NULL,
`CountryID` int(11) DEFAULT NULL,
`Description` text,
`IsActive` bit(1) DEFAULT NULL,
`CreationDatestamp` char(8) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `FK_province_country_idx` (`CountryID`),
约束FK_province_country
外键 ( CountryID
) 引用country
( ID
) ON DELETE NO ACTION ON UPDATE NO ACTION)
ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1$$