If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Very simple 10-line stored procedure error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-05, 13:45
phpmysql phpmysql is offline
Registered User
 
Join Date: Nov 2005
Posts: 1
Very simple 10-line stored procedure error

It says this procedure has invalid syntax. How do I fix this procedure?
I tried it for hours but didn't work and it's frustrating.

CREATE PROCEDURE `gcd` (a INT, b INT) RETURNS INTEGER
BEGIN
DECLARE t INTEGER;
loop_label: WHILE b <> 0 DO
SET t = b;
SET b = MOD(a, b);
SET a = t;
END WHILE;
RETURN a;
END

Thanks!
Reply With Quote
  #2 (permalink)  
Old 11-08-05, 13:58
felixg felixg is offline
Registered User
 
Join Date: Apr 2005
Location: Lier, Belgium
Posts: 122
Quote:
Originally Posted by phpmysql
It says this procedure has invalid syntax.

CREATE PROCEDURE `gcd` (a INT, b INT) RETURNS INTEGER
PROCEDUREs don't return values. FUNCTIONs do.

--
felix
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On