Stored Procedures and DECLARE weirdness

2006-06-09 Thread Chris White
Hello all and thanks again for any responses.

I'm hoping this is something really basic I'm not seeing.  I have MySQL 
5.0.22-log, and I'm having a weird time creating a basic stored procedure.  I 
get this far:

mysql CREATE PROCEDURE getRootId (IN company_id INT)
- BEGIN
- DECLARE variable1 INT;
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 'INT' at line 3

Now, as stated in the MySQL manual, I have my DECLARE statement as the first 
line after the BEGIN clause.  Anything else I'm missing?
-- 
Chris White
PHP Programmer/DB Knight
Interfuel

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Stored Procedures and DECLARE weirdness

2006-06-09 Thread Paul DuBois

Hello all and thanks again for any responses.

I'm hoping this is something really basic I'm not seeing.  I have MySQL
5.0.22-log, and I'm having a weird time creating a basic stored procedure.  I
get this far:

mysql CREATE PROCEDURE getRootId (IN company_id INT)
- BEGIN
- DECLARE variable1 INT;
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 'INT' at line 3

Now, as stated in the MySQL manual, I have my DECLARE statement as the first
line after the BEGIN clause.  Anything else I'm missing?


When you use the mysql client, you must redefine the statement delimiter
during definition of a stored routine (or trigger or event) that uses
compound statement syntax with multiple statements making up the body of
the routine.  See the example near the end of this section:

http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

Also: http://dev.mysql.com/doc/refman/5.0/en/begin-end.html


--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Stored Procedures and DECLARE weirdness

2006-06-09 Thread Chris White
On Friday 09 June 2006 02:31 pm, Paul DuBois wrote:
 When you use the mysql client, you must redefine the statement delimiter
 during definition of a stored routine (or trigger or event) that uses
 compound statement syntax with multiple statements making up the body of
 the routine.  See the example near the end of this section:

Ah, that was it.  Looks like I didn't RTFM in-depth enough.  Well I'm glad 
that's solved, I thought it was something weird on my side when I didn't see 
any bugs for it :).

 --
 Paul DuBois, MySQL Documentation Team
 Madison, Wisconsin, USA
 MySQL AB, www.mysql.com

-- 
Chris White
PHP Programmer/DB Unofficial
Interfuel

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]