Unix Technical Forum

stored procedures in mysql 5

This is a discussion on stored procedures in mysql 5 within the MySQL forums, part of the Database Server Software category; --> HI all I am having trouble creating a stored procedure in Mysql 5. I have even tried the simple ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 08:32 AM
bpietersen@gmail.com
 
Posts: n/a
Default stored procedures in mysql 5

HI all

I am having trouble creating a stored procedure in Mysql 5. I have even
tried the simple examples from the Mysql manual. I am using Mysql
5.0.18-log and phpMyAdmin 2.7.0-pl2. I have even tried it through the
console.

Here is my statements and sp -

mysql> delimiter |

mysql> CREATE PROCEDURE GetVerify (IN VarUserId INT, IN VarCallCentreId
INT, OUT VarServiceId INT)

BEGIN

SELECT sa.ServiceApplicationId INTO VarServiceId
FROM ServiceApplication AS sa
JOIN UserQueue AS uqu ON uqu.StatusId = sa.ServiceApplicationId
AND uqu.UserId = VarUserId
JOIN UserMaster AS um ON um.UserId = sa.UserId AND um.CallCentreId =
VarCallCentreId
WHERE sa.StatusId = 62015;

IF VarServiceId IS NULL
SELECT sa.ServiceApplicationId INTO VarServiceId
FROM ServiceApplication sa
JOIN UserMaster um ON um.UserId = sa.UserId AND um.CallCentreId =
VarCallCentreId
WHERE sa.StatusId = 62014;
END IF;

END|

mysql> delimeter ;

Unfortunately, it produces the following error -

#1064 - 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 'SELECT sa.ServiceApplicationId INTO VarServiceId
FROM ServiceApplication AS s' at line 5

Any help with this will be greatly appreciated.

Cheers for now.

B Pietersen.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com