Connecting Tech Pros Worldwide Forums | Help | Site Map

error 1064 stored procedure using navicat

Newbie
 
Join Date: Aug 2009
Posts: 7
#1: Aug 26 '09
I'm attempting to create/update a stored procedure. it's within the navicat environment but after looking and reading various forums the environment that I'm using to create it doesn't seem to be an issue. is there anything you can see that I'm not?

i'm guessing it's something small my eyes have continued to overlook

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE `communityFloorplans`(in generalCommunity varchar(55), in priceRange varchar(10), in minBed varchar(2), in minBath varchar(2))
  2. begin
  3.  
  4. set @minimumBed   = 2;
  5. set @minimumBath  = 2;
  6. set @minimumPrice  = 150000;
  7. set @maximumPrice = 160000;
  8.  
  9. select
  10.     c.communityID, c.communityName, min(l.price) 
  11. from 
  12.     communities c, listings l
  13. where
  14.     l.communityID = c.communityID
  15. and
  16.     case  generalCommunity when 'Lakeland' 
  17.         then    c.addrCity = 'Lakeland' OR c.addrCity= 'Bartow' OR c.addrCity = 'Mulberry'
  18.       when 'Winter Haven' 
  19.         then    c.addrCity = 'Lake Hamilton' OR c.addrCity = 'Winter Haven' OR c.addrCity = 'Davenport'
  20.       when 'Tampa'
  21.         then    c.addrCity = 'Wimauma' OR c.addrCity = 'Wesley Chapel' OR c.addrCity = 'Tampa'
  22.       when 'Orlando' 
  23.         then    c.addrCity = 'Orlando'
  24.       when 'Leesburg' 
  25.         then    c.addrCity = 'Leesburg'
  26. and
  27.     l.beds >= @minimumBed
  28. and
  29.     l.baths >= @minimumBath
  30. and
  31.     l.price between @minimumPrice and @maximumPrice
  32.  group by 
  33.      c.communityid, c.communityname
  34. order by
  35.     c.communityname
  36. end
  37.  

Newbie
 
Join Date: Aug 2009
Posts: 7
#2: Aug 26 '09

re: error 1064 stored procedure using navicat


i added an END to the Case section
# case generalCommunity when 'Lakeland'
# then c.addrCity = 'Lakeland' OR c.addrCity= 'Bartow' OR c.addrCity = 'Mulberry'
# when 'Winter Haven'
# then c.addrCity = 'Lake Hamilton' OR c.addrCity = 'Winter Haven' OR c.addrCity = 'Davenport'
# when 'Tampa'
# then c.addrCity = 'Wimauma' OR c.addrCity = 'Wesley Chapel' OR c.addrCity = 'Tampa'
# when 'Orlando'
# then c.addrCity = 'Orlando'
# when 'Leesburg'
# then c.addrCity = 'Leesburg'
# END

I also added a @ to generalCommunity with an assigned value 'Lakeland' just to see if I can save it. Now I can save the sp but when I tried to assign the input parameters as I would expect dynamic values to populate the input params I get the error all over again. <scratch my head>
Reply