日期:2014-05-16 浏览次数:20928 次
drop procedure if exists proc_tblModelInfo_Insert create procedure proc_tblModelInfo_Insert( out ID int, PersonID int, FilePath nvarchar(256) ) begin insert into ModelInfo(`PersonID`,`FilePath`) values(PersonID,FilePath); set ID = (select max(`id`) from ModelInfo); end
------解决方案--------------------
mysql 写存储过程 一般要先定义定界付
用 DELEMITER
------解决方案--------------------
drop procedure if exists proc_tblModelInfo_Insert
DELIMITER $$
create procedure proc_tblModelInfo_Insert(
out ID int,
vPersonID int,
vFilePath nvarchar(256)
)
begin
insert into ModelInfo(PersonID,FilePath) values(vPersonID,vFilePath);
set ID = (select max('id') from ModelInfo);
END$$
DELIMITER ;
------解决方案--------------------
提问时请把错误信息一同贴出以供别人分析。
问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧)
------解决方案--------------------
细节问题,多加注意
在drop procedure if exists proc_tblModelInfo_Insert 后面加分号测不过找我!
应该这下面这样
===============================
drop procedure if exists proc_tblModelInfo_Insert ; //这里需要以分号结束好的
DELIMITER $$
create procedure proc_tblModelInfo_Insert(
out ID int,
vPersonID int,
vFilePath nvarchar(256)
)
begin
insert into ModelInfo(PersonID,FilePath) values(vPersonID,vFilePath);
set ID = (select max('id') from ModelInfo);
END $$
DELIMITER ;
=========================================================
------解决方案--------------------
drop procedure if exists proc_tblModelInfo_Insert
delimiter$$
create procedure proc_tblModelInfo_Insert(
out ID int,
PersonID int,
FilePath nvarchar(256)
)
begin
insert into ModelInfo('PersonID','FilePath') values(PersonID,FilePath)
set ID = (select max('id') from ModelInfo)
end $$
delimiter;
delimiter$$
------解决方案--------------------
drop procedure if exists proc_tblModelInfo_Insert
delimiter$$
create procedure proc_tblModelInfo_Insert(
out ID int,
PersonID int,
FilePath nvarchar(256)
)
begin
insert into ModelInfo('PersonID','FilePath') values(PersonID,FilePath)
set ID = (select max('id') from ModelInfo)
end $$
delimiter;