Professional Web Applications Themes

newbie: What is wrong in this SP? - MySQL

Hey I'm new to MySql5 and I'm trying to write my first stored procedure. Below is a stored procedure I'm trying to add to the database, but it gives errors (the 2 errors are listed below too)... I'm stucked here. CREATE PROCEDURE SaveProperty() BEGIN DECLARE var1 INT; END; 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 'var1 INT' at line 3 mysql> END; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to ...

  1. #1

    Default newbie: What is wrong in this SP?

    Hey

    I'm new to MySql5 and I'm trying to write my first stored procedure. Below
    is a stored procedure I'm trying to add to the database, but it gives errors
    (the 2 errors are listed below too)... I'm stucked here.

    CREATE PROCEDURE SaveProperty()
    BEGIN
    DECLARE var1 INT;
    END;

    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
    'var1
    INT' at line 3
    mysql> END;
    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
    'END'
    at line 1

    Any suggestions to what I'm doing wrong are welcome!

    Jeff


    Jeff Guest

  2. #2

    Default Re: newbie: What is wrong in this SP?

    "Jeff" <com.NOSPAM> wrote: 
     

    You're trying to declare a user variable. User variables have names
    starting with and must not be declared. The scope of a user variable
    is the connection, the scope of a local variable is the surrounding
    BEGIN ... END block. Local variable names must not start with .
    Try this:

    CREATE PROCEDURE SaveProperty()
    BEGIN
    DECLARE var1 INT;
    END;


    XL
    --
    Axel Schwenke, Support Engineer, MySQL AB

    Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    MySQL User Forums: http://forums.mysql.com/
    Axel Guest

  3. #3

    Default Re: newbie: What is wrong in this SP?

    thanks


    "Axel Schwenke" <de> wrote in message
    news:homelinux.org... 

    >
    > You're trying to declare a user variable. User variables have names
    > starting with and must not be declared. The scope of a user variable
    > is the connection, the scope of a local variable is the surrounding
    > BEGIN ... END block. Local variable names must not start with .
    > Try this:
    >
    > CREATE PROCEDURE SaveProperty()
    > BEGIN
    > DECLARE var1 INT;
    > END;
    >
    >
    > XL
    > --
    > Axel Schwenke, Support Engineer, MySQL AB
    >
    > Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    > MySQL User Forums: http://forums.mysql.com/[/ref]


    Jeff Guest

Similar Threads

  1. Replies: 5
    Last Post: July 10th, 07:52 PM
  2. Continuing with HELP can someone tell me whats wrong here? (newbie)
    By Mark Clarkstone in forum PHP Development
    Replies: 5
    Last Post: July 10th, 06:30 PM
  3. Replies: 0
    Last Post: July 10th, 03:39 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