473,396 Members | 1,871 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,396 software developers and data experts.

how to write stored procedures in mysql?

1. i want to write a stored procedure using mysql 5.0.45 version.

2. when i tried with the following code ,i am unable to write
Expand|Select|Wrap|Line Numbers
  1. mysql->delimeter//
  2.          ->create procedure proc(out p1 int)
  3.          ->select count(*) into p1 from emp;
  4.  
when i pressed enter, the following error is appeared .
Expand|Select|Wrap|Line Numbers
  1. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
  2. corresponds to your MySQL server version for the right syntax to use near 'delim
  3. eter//
  4. create procedure proc(out p1 int)
  5. select count(*) into p1 from emp' at line 1
  6.  
3.i even checked the manual of mysql 5.0 ver
the syntax is right


please,someone help me in this problem....
Jul 15 '08 #1
3 6133
Atli
5,058 Expert 4TB
Hi.

That particular problem would be that there is no space between the DELIMITER command and the parameter you are passing it.

I would also guess that the fact you didn't end the procedure with a END would cause a problem later on.

Check out the correct syntax for stored procedures in the manual. (The two examples right above the user comments show it very well.)
Jul 16 '08 #2
when i tried with the following code the procedure got executed

mysql->create procedure proc(inout n int,out p int)
set m=n+1;

mysql->set @n=5;
mysql->call proc(@n,@m);
mysql->select @n,@m;

the output is @n @m
5 6


but when iam using begin statement with the following code,i am getting error

mysql->create procedure proc(inout n int m,out p int)
->begin
->set m=n+1;

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 'out p
int' at line 2


if someone knows what is the error please,kindly help me....
Jul 16 '08 #3
amitpatel66
2,367 Expert 2GB
This should help!! .
Jul 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

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...
3
by: menmysql | last post by:
i am using mysql 4.17 and i heard abt it not supporting stored procedures. plz tell me how to excute stored procedres in my system
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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...

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.