Professional Web Applications Themes

Stored Procedure Syntax error. - MySQL

I have this statement in a SQL file. CREATE PROCEDURE HAPPINESS (IN player BIGINT, IN turn INT) BEGIN UPDATE something SET something=player; UPDATE something2 set something2=turn; END; When I run this command: bash$ mysql -p table < storedprocedure.sql I get this error. ERROR 1064 (42000) at line 1: 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 'UPDATE something SET something=player;' at line 3 If i take out the BEGIN and END it works fine, but only includes the first UPDATE statement. The second ...

  1. #1

    Default Stored Procedure Syntax error.

    I have this statement in a SQL file.

    CREATE PROCEDURE HAPPINESS (IN player BIGINT, IN turn INT)
    BEGIN
    UPDATE something SET something=player;
    UPDATE something2 set something2=turn;
    END;

    When I run this command:

    bash$ mysql -p table < storedprocedure.sql

    I get this error.
    ERROR 1064 (42000) at line 1: 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 'UPDATE something SET something=player;' at
    line 3

    If i take out the BEGIN and END it works fine, but only includes the
    first UPDATE statement. The second one get ommited. Which is expected.
    It seems to have something to do with the BEGIN statement and I can't
    seem to figure it out. Any Suggestions?

    Ryan Guest

  2. #2

    Default Re: Stored Procedure Syntax error.


    "Ryan Knopp" wrote ... 

    delimiter /
    CREATE PROCEDURE HAPPINESS (IN player BIGINT, IN turn INT)
    BEGIN
    UPDATE something SET something=player;
    UPDATE something2 set something2=turn;
    END;
    /


    Regards
    Dimitre


    Radoulov, Guest

  3. #3

    Default Re: Stored Procedure Syntax error.



    On Dec 21, 1:08 pm, "Radoulov, Dimitre" <com> wrote: 





    > CREATE PROCEDURE HAPPINESS (IN player BIGINT, IN turn INT)
    > BEGIN
    > UPDATE something SET something=player;
    > UPDATE something2 set something2=turn;
    > END;
    > /
    >
    > Regards
    > Dimitre- Hide quoted text -- Show quoted text -[/ref]

    Ah, something so simple. For some reason I thought the delimiter was
    only for the command line.
    Thanks!

    Ryan Guest

Similar Threads

  1. Simple Stored Procedure Error
    By ism in forum Coldfusion Database Access
    Replies: 2
    Last Post: March 29th, 11:16 PM
  2. Stored procedure error
    By HariMaki in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: December 3rd, 12:59 PM
  3. ASP and stored procedure problem (syntax error ?)
    By Steven Scaife in forum ASP Database
    Replies: 4
    Last Post: August 13th, 12:11 PM
  4. stored procedure syntax help
    By anjelina in forum Microsoft SQL / MS SQL Server
    Replies: 7
    Last Post: July 14th, 10:58 AM
  5. C stored procedure SQL error.
    By Craig in forum IBM DB2
    Replies: 2
    Last Post: July 11th, 04:44 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139