我正在Mysql中创建一个存储过程。如何传递将接受null的值?
我知道在SQL Server 2008 R2中,我非常喜欢
@name varchar(10) = null
但我如何在Mysql中做到这一点?
DELIMITER $$
CREATE PROCEDURE `ipm_website`.`uspInsertFuelBuyDetails`( promotion_code VARCHAR(45)=NULL,eventid INT,Erid INT, first_name VARCHAR(255)=NULL,last_Name)
BEGIN
INSERT INTO ipm_fuel.TBL_EVENT_PAYMENTS
(promotion_code, EVENT_ID, EVENT_RATE_ID, FIRST_NAME, LAST_NAME, PHONE_NUMBER, EMAIL, ADDRESS1, ADDRESS2,
CITY, STATE, ZIPCODE, card_type, card_number, exmonth, exyear, total_amount,
admin_fee, license_plate, guid, date_added)
VALUES (promotion_code, eventid, Erid ,first_name ,last_Name ,phoneNo , email, address1, address2, city , state, ZIPCODE, card_type, card_no, exmonth, exyear, total_amount, admin_fee, licanse_plate,
guid, date_added);
END$$
DELIMITER ;
如何做到这一点,以及如何在参数中允许空值?