在mysql里写的存储过程:
DELIMITER $$
DROP PROCEDURE IF EXISTS `jdbc`.`addUser` $$
CREATE PROCEDURE `jdbc`.`addUser` (in pname varchar(45), in birthday Date, in money float, out pid int)
BEGIN
insert into user(name , birthday , money ) values ( pname , birthday , money );
select last_insert_id() into pid; // last_insert_id()是mysql里的函数,查找最后一条的id
//意思是把最后一条的id查出来,放到pid里
END $$
DELIMITER ;
------------------------------------------
用java调用存储过程: