Home > database >  Mysql stored procedures, insert a new item after the return to the automatic numbering
Mysql stored procedures, insert a new item after the return to the automatic numbering

Time:09-21

Mysql 5.5 phpadmin
Grammar changed? Try the wrong to the skull pain

The USE of school;
DROP PROCEDURE IF the EXISTS ` aa `;
CREATE PROCEDURE aa (
IN bb INT,
OUT the dd INT)
MODIFIES SQL DATA
The BEGIN
INSERT INTO zx_class (class_name)
VALUES (bb);
The SET @ dd=LAST_INSERT_ID ();
SELECT @ dd.
END

# 1064 - You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near 'at line 7

CodePudding user response:

Use the INSERT is no problem, use the SELECT LAST_INSERT_ID () also no problem
This is not science how things happen

CodePudding user response:

Try
The SET @ dd:=NULL;
The SELECT LAST_INSERT_ID () into @ dd.
  • Related