Reputation: 183
Just wondering, im new to stored procedures,
I just tried this
INSERT INTO new.emp SELECT * FROM old.users
and it worked and inserted the data of users from the old table users to the new emp table.
But when I did that inside a stored procedure im getting a syntax error
CREATE PROCEDURE insertnew
INSERT INTO new.emp SELECT * FROM old.users
What's the difference?
Upvotes: 0
Views: 1385
Reputation: 171
In what part of the query are you getting a syntax error? The correct syntax for creating a stored procedure is something like this:
DELIMITER //
CREATE PROCEDURE InsertEmployee()
BEGIN
INSERT INTO new.emp SELECT * FROM old.users;
END //
DELIMITER ;
Upvotes: 1