473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Stored procedures in MySql 5

Hi all,

I'm newbie in MySql and have been working for some time with MS Sql
Server; so i'm familiar with stored procedures.
However, i'm trying to create a simple stored procedure in MySql Query
Browser (assuming there is a table called 'Categories') such as:
Create Procedure sp_ShowAllCategories ()
BEGIN
SELECT * FROM Categories
END

but i always get ErrorNr. 1064

I checked the manual in MySql and i tried different variations using
DELIMITER but still the same error.

Any help?

Jan 6 '06 #1
5 1822
Hi,

You need to add a semicolon after the SELECT statement. To not confuse
MySQL, you have to set another delimiter first, so this should actually look
like this:

delimiter // -- to set the delimiter from ; to // - however, you can use any
delimiter that doesn't occur inside the Procedure

drop procedure if exists sp_ShowAllCategories //
create procedure sp_ShowAllCategories ()
BEGIN
SELECT * FROM Categories;
END //

delimiter ; -- to set the delimiter back to the default ;

Markus
Jan 6 '06 #2
well i did that and still i get error:

delimiter //
drop procedure if exists sp_ShowAllCountries //
create procedure sp_ShowAllCountries ()
BEGIN
SELECT * FROM countries;
END //
delimiter ;

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
'delimiter //
drop procedure if exists sp_ShowAllCountries //
create procedure ' at line 1
ErrorNr. 1064

Jan 7 '06 #3
I have tried to create this procedure and it worked.

Markus
Jan 7 '06 #4
"coosa" <co*****@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
well i did that and still i get error:

delimiter //
Don't you have to use the previously defined delimeter at the end of this
statement? E.g.:
delimeter // ;
drop procedure if exists sp_ShowAllCountries //
create procedure sp_ShowAllCountries ()
BEGIN
SELECT * FROM countries;
END //
delimiter ;
And likewise terminate the last line with the then-current delimeter:
delimeter ; //
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
'delimiter //
drop procedure if exists sp_ShowAllCountries //
create procedure ' at line 1
ErrorNr. 1064

Regards,
Bill K.
Jan 7 '06 #5
Hi Bill,

no, no - the delimiter statement is without the current delimiter at the
end. It's enough to only set the new delimiter ;-).

I've tried exactly the Stored Procedure that I specified and it worked on my
MySQL 5.0.18-nt-Max (even though the underlying table doesn't exist in my
database).

Markus
Jan 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Parker | last post by:
Does MySQL have support for calling functions in C/C++ DLLs from trigger scripts similar to the Extended Stored Procedures functionality provided in SQL Sever? Thanks. Charles... -- MySQL...
0
by: Chrisbarbers | last post by:
--part1_108.256bef7d.2c5af59f_boundary Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Hi =A0 I have purchased a package that uses ASP and SQL,...
3
by: Ben | last post by:
Dear MySQL experts, I have a website that is using MS SQL Server 2000 with ASP scripting. I want to switch over to MySQL, but I'm just sticking my toes in the water at the moment to see if it...
3
by: Marty | last post by:
Is there an issue with stored procedure and mySQL v5.0.18 ? We are programming an application that need stored procedures and triggers and our programmer can't make them work, is it a know issue...
1
by: E.T. Grey | last post by:
Hi All, Despite spending the past six to seven hours perusing the docs on the mySQl site, I still have questions unanswered, and have been unable to get any help. I am familiar with Sybase, some...
2
by: bshumsky06 | last post by:
Hi, I am trying to create stored procedures in MySQL. Does anyone have a suggestion on a good IDE to use. I have been working with the MySQL Query Browser but it generates errors very often and...
1
by: Radhakrishnans | last post by:
hai friends i am new to java and mysql.i have created stored procedures in mysql.Now i want to call that stored procedures in java.All works fine.but it show the following error. unreported...
0
by: Bruno Barberi Gnecco | last post by:
I'm using stored procedures in a PHP site, with mysql. I'm having problems with stored procedures. Of the two I'm using, one works all the time, consistently. The other works correctly, but the...
7
by: eholz1 | last post by:
Hello PHP group, Could someone help me out? I have PHP 5.2, Apache 2.0, and MySQL 5.0 running on Linux (Redhat Fedora Core 6). All that works fine. I would like to be able to "call" a stored...
1
by: Muhammad Intikhab Qaiser | last post by:
Hi I am developing a parser to parse the stored procedure and function definition of MySQL.I need to extract the names of stored procedures,functions and tables which are being used in any...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.