473,407 Members | 2,314 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,407 software developers and data experts.

Simple Stored Procedure Broken

42
I'm still trying to get the hang of stored procedures. In the constant cycle of revising a procedure, I need to drop a procedure if it's already in the database and add its replacement. Not hard. So what's wrong with this easy drop/add procedure sequence?

Expand|Select|Wrap|Line Numbers
  1. DROP PROCEDURE changeValue;
  2. ADD PROCEDURE changeValue (IN val INT)
  3. BEGIN
  4.     SET val = val - 1;
  5. END;
Each statement individually works, and I can't spot anything that would break the query above. Heck, I can't spot any differences between this and sample code.
Oct 4 '07 #1
8 1509
I'm still trying to get the hang of stored procedures. In the constant cycle of revising a procedure, I need to drop a procedure if it's already in the database and add its replacement. Not hard. So what's wrong with this easy drop/add procedure sequence?

Expand|Select|Wrap|Line Numbers
  1. DROP PROCEDURE changeValue;
  2. ADD PROCEDURE changeValue (IN val INT)
  3. BEGIN
  4.     SET val = val - 1;
  5. END;
Each statement individually works, and I can't spot anything that would break the query above. Heck, I can't spot any differences between this and sample code.

If I'm not mistaken, it's CREATE PROCEDURE, not ADD PROCEDURE

maybe that's the error?
Oct 4 '07 #2
spamguy
42
Oh god. *facepalm*

I must've started out with CREATE PROCEDURE (because it had processed earlier), and then changed it to ADD PROCEDURE along the line.

Thanks!
Oct 4 '07 #3
spamguy
42
OK, looks like I'm still stumped. This version, too, has a syntax problem I can't spot. Disregard the fact that inValue and dayCount don't do anything.

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE myProc (IN inValue INT)
  2. BEGIN
  3.   DECLARE myCount INT;
  4. END;
Oct 4 '07 #4
pbmods
5,821 Expert 4TB
Heya, Spamguy.

What is the full text of the error that MySQL is reporting?
Oct 4 '07 #5
spamguy
42
Hiya:

I'll pass it along when I get to the database tomorrow morning. But trying it on a second computer, it works. Doubly baffling!
Oct 5 '07 #6
pbmods
5,821 Expert 4TB
Heya, Spamguy.

Is the procedure already created on the other computer?

Try calling
Expand|Select|Wrap|Line Numbers
  1. DROP PROCEDURE myProc;
first.
Oct 5 '07 #7
spamguy
42
I...don't understand. I spent 15 minutes yesterday debugging this procedure before posting here. And now it works effortlessly. *sigh*

Thanks anyway.
Oct 5 '07 #8
pbmods
5,821 Expert 4TB
Heya, Spamguy.

Figure it this way:

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Oct 5 '07 #9

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

Similar topics

3
by: kjc | last post by:
I have a stored procedure what produces N number of rows. The rows are ordered by a cataegoryType as follows catA catB catC What is needed to do on the C++ code side is break these out...
5
by: mas | last post by:
I have a Stored Procedure (SP) that creates the data required for a report that I show on a web page. The SP does all the work and just returns back a results set that I dump in an ASP.NET...
5
by: Lili | last post by:
I'm having problems creating a simple stored procedure in DB2. Can someone help? Here is the screen dump when I tried to load the stored procedure. Thanks for any help. Create procedure...
3
by: Nils Magnus Englund | last post by:
Hi, I've made a HttpModule which deals with user authentication. On the first request in a users session, it fetches data from a SQL Server using the following code: using (SqlConnection...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
1
by: E.T. Grey | last post by:
I have been busting my nut over this for pretty much most of the day and it is driving me nuts. I posted this to an mySQL ng yesterday and I have not had any response (I'm pulling my hair out...
4
by: James | last post by:
How can I see/set the timeout for a postback? I have a button click event which loops through a DataSet and calls a stored procedure for every record in the dataset. This can be a very large...
1
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( )...
1
by: Ted | last post by:
In MS SQL I used the following to create a stored procedure. USE AdventureWorks; GO IF OBJECT_ID ( 'HumanResources.usp_My_Search', 'P' ) IS NOT NULL DROP PROCEDURE HumanResources.usp_My_Search;...
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
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
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...
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,...
0
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...

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.