![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| DELIMITER // DROP PROCEDURE IF EXISTS `ips`.`fetchlocationsfiltered` // CREATE PROCEDURE `fetchlocationsfiltered`( _locationname VARCHAR(50), _locationstate VARCHAR(3), _locationpostcode VARCHAR(4) ) IF (_locationpostcode='') THEN SELECT locationname FROM locations WHERE locationname=_locationname AND locationstate=_locationstate END IF DELIMITER ; This procedure continually causes error 1064 whereas the following, same as above but without the IF statement, works perfectly: DELIMITER // DROP PROCEDURE IF EXISTS `ips`.`fetchlocationsfiltered` // CREATE PROCEDURE `fetchlocationsfiltered`( _locationname VARCHAR(50), _locationstate VARCHAR(3), _locationpostcode VARCHAR(4) ) SELECT locationname FROM locations WHERE locationname=_locationname AND locationstate=_locationstate // DELIMITER ; I have tried delimiters after the SQL statement and after the END IF however none solve the problem. I have read posts where some people experience error 1064 where other don't with the same code... I am using MySQL 5 on windows and am using the query browser software. Thanks in advance... | |||
| | #2 | ||
| Struggle with this for hours then post the question and 2 mins later solved... I was mixing up my delimeters... the correct procedure is: DELIMITER // DROP PROCEDURE IF EXISTS `ips`.`fetchlocationsfiltered` // CREATE PROCEDURE `fetchlocationsfiltered`( _locationname VARCHAR(50), _locationstate VARCHAR(3), _locationpostcode VARCHAR(4) ) IF (_locationpostcode='') THEN SELECT locationname FROM locations WHERE locationname=_locationname AND locationstate=_locationstate; END IF; // DELIMITER ; Thanks anyway... "McHenry" <mchenry@mchenry.com> wrote in message news:4456d848$0$16926$5a62ac22@per-qv1-newsreader-01.iinet.net.au... > DELIMITER // > > DROP PROCEDURE IF EXISTS `ips`.`fetchlocationsfiltered` // > CREATE PROCEDURE `fetchlocationsfiltered`( > _locationname VARCHAR(50), > _locationstate VARCHAR(3), > _locationpostcode VARCHAR(4) > ) > IF (_locationpostcode='') THEN > SELECT locationname > FROM locations > WHERE locationname=_locationname > AND locationstate=_locationstate > END IF > > DELIMITER ; > > > This procedure continually causes error 1064 whereas the following, same > as above but without the IF statement, works perfectly: > > DELIMITER // > > DROP PROCEDURE IF EXISTS `ips`.`fetchlocationsfiltered` // > CREATE PROCEDURE `fetchlocationsfiltered`( > _locationname VARCHAR(50), > _locationstate VARCHAR(3), > _locationpostcode VARCHAR(4) > ) > SELECT locationname > FROM locations > WHERE locationname=_locationname > AND locationstate=_locationstate // > > DELIMITER ; > > > I have tried delimiters after the SQL statement and after the END IF > however none solve the problem. > > I have read posts where some people experience error 1064 where other > don't with the same code... > > I am using MySQL 5 on windows and am using the query browser software. > > Thanks in advance... > | |||
| Featured Websites | ||||
|
![]() |
| Tags: error, procedure, simple, stored |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing table name as argument to a stored procedure | robocop | Database | 0 | 06-10-2007 12:19 AM |
| Whats wrong with these simple stored proc? (second pair of eyes needed urgently) | robocop | Database | 0 | 06-10-2007 12:19 AM |
| how to get records from stored procedure using ASP | Bill | Database | 0 | 06-10-2007 12:19 AM |
| View photo stored into CD or DVD | Hervé | Computer Consoles | 2 | 05-30-2007 11:08 PM |
| PEAR DB ERROR: db_error: message="DB Error: insufficient data supplied" code=-20 | Kevin McCarthy | Pear | 0 | 05-20-2007 6:34 PM |
| Featured Websites | ||||
|