HELP: MySQL Procedure

iosoft

PC enthusiast since MS DOS 5
Skilled
I can't create a MySQL 5.0 Procedure. Can't find the error !!

Purpose -

It will just make copy of the record from one table to another.

I will give the ID (int-11) as parameter. eno (primary) is also int-11.

my Code -

Code:
CREATE PROCEDURE CopyMe (

   IN id int(11)

)

BEGIN

INSERT INTO table1 SELECT * FROM table2 WHERE eno=id AND id NOT NULL;

END;

Error -

#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 3
 
^ No same error :S

NOTE1:
I can execute this query successfully -
Code:
INSERT INTO table1 SELECT * FROM table2 WHERE eno=15;
problem happens when adding it to a PROCEDURE !!

NOTE2:
I am using phpMyAdmin.
 
I know Oracle but never worked on MySQL:
Can you try this, find it from google:

CREATE PROCEDURE CopyMe(
IN id INT
)
BEGIN
INSERT INTO table1 SELECT * FROM table2 WHERE eno=id AND id NOT NULL;
END
 
Back
Top