f



stored procedures - syntax error

Hi all,

             I am using mysql 5.0.54, i want to create procedure, i
tried an example in mysql link
"CREATE PROCEDURE sp1 (x VARCHAR(5))
  BEGIN
    DECLARE xname VARCHAR(5) DEFAULT 'bob';
    DECLARE newname VARCHAR(5);
    DECLARE xid INT;

    SELECT xname,id INTO newname,xid
      FROM table1 WHERE xname = xname;
    SELECT newname;
  END;"
but i see an error "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 '' at line 3",
  In all links & documentation i find the same syntax for declare
statements, i have also created a table which the stored procedure
points to. There is no exact documentation or links for this in MySQL.
I wont get any replies for posts in mysql, so im posting here.. please
please guide me ASAP ... waiting for ur reply..

Thanks in Advance
0
agnesroz (9)
1/24/2008 10:42:58 AM
comp.databases.mysql 6944 articles. 1 followers. laredotornado (869) is leader. Post Follow

1 Replies
308 Views

Similar Articles

[PageSpeed] 21

On 24 Jan, 10:42, agnes...@gmail.com wrote:
> Hi all,
>
>              I am using mysql 5.0.54, i want to create procedure, i
> tried an example in mysql link
> "CREATE PROCEDURE sp1 (x VARCHAR(5))
>   BEGIN
>     DECLARE xname VARCHAR(5) DEFAULT 'bob';
>     DECLARE newname VARCHAR(5);
>     DECLARE xid INT;
>
>     SELECT xname,id INTO newname,xid
>       FROM table1 WHERE xname = xname;
>     SELECT newname;
>   END;"
> but i see an error "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 '' at line 3",
>   In all links & documentation i find the same syntax for declare
> statements, i have also created a table which the stored procedure
> points to. There is no exact documentation or links for this in MySQL.
> I wont get any replies for posts in mysql, so im posting here.. please
> please guide me ASAP ... waiting for ur reply..
>
> Thanks in Advance

The answer is here
http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
Note the DELIMITER command
0
Captain
1/24/2008 10:50:18 AM
Reply: