MySQL Forums
Forum List  »  Knowledge Base

How to create PROCEDURE?
Posted by: Shen Wenjie
Date: March 14, 2009 01:20AM

I followed the steps in the Internet, but it failed.

1.create a table
CREATE TABLE `proctest` (
`id` int ( 11 ) NOT NULL auto_increment,
`Name` varchar ( 20 ) default '''''' ,
`age` int ( 11 ) default NULL ,
`address` varchar ( 50 ) default '' ,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = gb2312;

2.insert something into it.
INSERT INTO `proctest` VALUES ( 1 , ' tom ' , 22 , '
http://www.blogjava.net ' );
INSERT INTO `proctest` VALUES ( 2 , ' wujun ' , 25 , '
http://www.blogjava.net/wujun ' );
INSERT INTO `proctest` VALUES ( 3 , ' jerry ' , 30 , ' shenzhen ' );
INSERT INTO `proctest` VALUES ( 4 , ' wujun ' , 40 , ' nanchang ' );

3.create PROCEDURE
create PROCEDURE testProc()
begin
select * from proctest;
end ;


but some problem occured...
mysql> create PROCEDURE testProc()
-> begin
-> select * from proctest;
ERROR 1064 (42000): 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

T_T
Can you tell me what the problem is, please?

Options: ReplyQuote


Subject
Views
Written By
Posted
How to create PROCEDURE?
30904
March 14, 2009 01:20AM
8258
April 13, 2009 06:31PM
6072
June 19, 2009 10:02AM
4459
August 02, 2009 09:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.