Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Unanswered: 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!

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •