473,799 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ShowAllCateg ories ()
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 1837
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_ShowAllCateg ories //
create procedure sp_ShowAllCateg ories ()
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_ShowAllCount ries //
create procedure sp_ShowAllCount ries ()
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_ShowAllCount ries //
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******** *************@o 13g2000cwo.goog legroups.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_ShowAllCount ries //
create procedure sp_ShowAllCount ries ()
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_ShowAllCount ries //
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
1801
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 General Mailing List For list archives: http://lists.mysql.com/mysql
0
1822
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, my webhost provides MYSQL=20 and I have loaded my access database and all seems to be working fine.=20
3
2090
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 makes sense. One of my favorites things about MS SQL is being able to use the Enterprise Manager as a GUI in constructing VIEWS that I later turn into stored procedures. EM makes it super simple to link tables and create a query. It basically...
3
1972
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 or our programmer missed something? Regards, Marty
1
1591
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 Oracle and PostgreSQL - but the mySQL SQL seems a bit "non-standard". I would be very grateful for any help I get in answering these questions: Stored procedures
2
6125
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 is shut down by Windows. When I make changes to my procedure, it doesn't seem to always change what is being executed. Furthermore, sometimes the procedure just disappears from my database. I am starting to think that the stored procedure...
1
10122
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 exception java.lang.InstantiationException; must be caught or declared to be thrown Class.forName ("com.mysql.jdbc.Driver").newInstance(); I need code sample along with connection string.please.... My codings here CallableStatement proc =...
0
1738
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 next query returns "Lost connection to MySQL server during query" and subsequently: "MySQL server has gone away". I'm using MDB2 to access the database. I tried changing the driver from 'mysql' to 'mysqli', with little success. Currently, about...
7
5846
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 procedure from a PHP program, and run a stored procedure. I have yet to figure out the proper way to do this. My stored procedures work fine from the mysql command line using syntax: "call sp_min_record (101);"
1
1855
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 particular stored procedure definition.How i can get this information? Also i want to know at what places within the stored procedures are the names of tables and other stored procedures can be used? Thanks
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.