UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 7th June 2008, 02:23 AM   #1 (permalink)
jc297
Registered User
 
Join Date: Feb 2004
Location: London
Posts: 25
stored procedure - undefined variable?

Hi,

Pretty new to stored procedures and right now just trying to get the following test stored procedure creation to work but instead I get a strange message:
mysql> DELIMITER //
mysql> CREATE PROCEDURE `proc_owner_details`(IN subdomain VARCHAR(20), OUT ositeURL VARCHAR(20), OUT ositeRef INT)
-> BEGIN
-> SELECT siteURL INTO ositeURL, siteRef INTO ositeRef FROM site_details WHERE site_details.siteURL = subdomain LIMIT 1;
-> END;
-> //
ERROR 1327 (42000): Undeclared variable: siteRef
mysql>

It seems it's the second field definition that's always causing a problem as when I swap siteURL and siteRef around then it's siteURL's turn to be an undeclared variable.

When I tried searching for answers all I could find was people having problems with the equivalent of "Undeclared variable: ositeRef"

Any help would be greatly appreciated.

Thanks in advance,

John
jc297 is offline   Reply With Quote
Old 7th June 2008, 11:02 AM   #2 (permalink)
Alex.
Registered User
 
Join Date: Jun 2007
Location: UK
Posts: 108
Send a message via MSN to Alex.
I'm pretty sure stored procedures are mysql 5 only, and I think UH only have mysql 4.
Alex. is offline   Reply With Quote
Old 7th June 2008, 01:01 PM   #3 (permalink)
jc297
Registered User
 
Join Date: Feb 2004
Location: London
Posts: 25
D'oh! Forgot to mention I'm on a dedicated server with MySQL 5
jc297 is offline   Reply With Quote
Old 7th June 2008, 10:57 PM   #4 (permalink)
jc297
Registered User
 
Join Date: Feb 2004
Location: London
Posts: 25
For ref: finally found out what I was doing wrong. The syntax of INTO for multiple columns is

SELECT siteURL, siteRef INTO ositeURL, ositeRef FROM ...

Which is clearly stated in MySQL documentation (MySQL :: MySQL 5.1 Reference Manual :: 21.2.7.3 SELECT ... INTO Statement)

Feel soooo foolish .
jc297 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 04:08 PM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309