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

Stored Procedure Woes

Hello,

Decided (Finally!!!) to start testing out some of the new features 5.x has to offer. More specifically stored procedures and functions.
I have tried to create a procedure but I continue to get an error and I think my syntax is correct.....
Here is the code:
CREATE PROCEDURE usp_GetPermissionGroups
(
IN WebFileName varchar(50),
IN PermGroupID int,
IN Action varchar(10)
)
BEGIN
SELECT * FROM webmanagement_filelist wf
LEFT JOIN webmanagement_groupstofiles wg ON wf.intWebFileID = wg.intWebFileID
WHERE txtWebFileName= WebFileName AND intPermissionGroupID = PermGroupID AND txtActionRequested = Action
END

The SQL statement works fine on it's own and that is not the problem. The error is given for line 8 Which is where the Select statement begins, however
I see no error there. Could someone point me in the right direction with this. It is possible that the rest of my CREATE PROC statement is incorrect.
Any help would be appreciated.
Jul 20 '05 #1
1 1347
FYI,

Figured out my own question. Seems like the BEGIN....END block wasn't working correctly. I removed it and it worked. I figured
this out by reading the examples at the bottom of http://dev.mysql.com/doc/mysql/en/CREATE_PROCEDURE.html

The user states:

The problem was that the block within the Procedure was of multiple SQL statements.
To do that, you must surround it within a BEGIN ... END block.

//End

Since I did not have a block of statements I decided to remove the BEGIN...END and everything worked as I expected.


The Collective wrote:
Hello,

Decided (Finally!!!) to start testing out some of the new features 5.x
has to offer. More specifically stored procedures and functions.
I have tried to create a procedure but I continue to get an error and I
think my syntax is correct.....
Here is the code:
CREATE PROCEDURE usp_GetPermissionGroups
(
IN WebFileName varchar(50),
IN PermGroupID int,
IN Action varchar(10)
)
BEGIN
SELECT * FROM webmanagement_filelist wf
LEFT JOIN webmanagement_groupstofiles wg ON wf.intWebFileID =
wg.intWebFileID
WHERE txtWebFileName= WebFileName AND intPermissionGroupID =
PermGroupID AND txtActionRequested = Action
END

The SQL statement works fine on it's own and that is not the problem.
The error is given for line 8 Which is where the Select statement
begins, however
I see no error there. Could someone point me in the right direction with
this. It is possible that the rest of my CREATE PROC statement is
incorrect.
Any help would be appreciated.

Jul 20 '05 #2

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

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
3
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
by: Andrew Hall | last post by:
Hello, We are using a number of stored procedures that are called often from our client programs. I include one here as an example. The problem we are seeing is that when executing some of these...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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:
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
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...

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.