我写的函数如下:
CREATE FUNCTION `getnext`(tbname char(20)) RETURNS int
BEGIN
declare aaa char(51);
set aaa='update' +tbname+ 'set id=LAST_INSERT_ID(id+1)';
execute aaa;
return LAST_INSERT_ID();
END $$
执行的时候总是说函数里面不能动态执行。。。
谢谢高手帮忙
...全文
7153打赏收藏
mysql函数中传入表名参数的问题!
我写的函数如下: CREATE FUNCTION `getnext`(tbname char(20)) RETURNS int BEGIN declare aaa char(51); set aaa='update' +tbname+ 'set id=LAST_INSERT_ID(id+1)'; execute aaa; return LAST_INSERT_ID(); END $$ 执行的时候总是说函数里面不能动态执行。。。 谢谢高手帮忙