List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:July 7 2005 7:00pm
Subject:Re: Stored function problems (Was: UDF failure)
View as plain text  
Nic,

At the end of the func, your sproc delimiter // needs to come before 
restoration of the semi-colon as delimiter, thus:

DELIMITER //
CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!');
//
DELIMITER ;

PB

-----

Nic Stevens wrote:

> Hi, 
>
>Still having difficulty with stored functions. I downloaded and installed 
>MySQL 5.0.7 and
>I *still* cannot get stored functions to work. 
>
>I used the example for hello from section 19.2.1 of the online documentation 
>for MySQL and the example code doesnt work for me either. 
>
>Below are the versions from, respectively, the MySQL cli, the MySQL server 
>and my Linux and following that is a transcript from the mysql cli trying to 
>create the hello function. 
>
>
>mysql Ver 14.11 Distrib 5.0.7-beta, for pc-linux-gnu (i686) using readline 
>4.3
>mysqld Ver 5.0.7-beta-standard for pc-linux-gnu on i686 (MySQL Community 
>Edition - Standard (GPL)
>Linux colinux 2.6.10-co-0.6.2 #5 Sat Feb 5 10:19:16 IST 2005 i686 i686 i386 
>GNU/Linux
>
>Welcome to the MySQL monitor. Commands end with ; or \g.
>Your MySQL connection id is 30 to server version: 5.0.7-beta-standard
>
>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
>mysql> DELIMITER //
>mysql>
>mysql> CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)
>-> RETURN CONCAT('Hello, ',s,'!');
>->
>-> DELIMITER ;
>-> //
>ERROR 1064 (42000): 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 'RETURN CONCAT('Hello, ',s,'!');
>DELIMITER' at line 2
>
>
>
>  
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.323 / Virus Database: 267.8.10/43 - Release Date: 7/6/2005
>  
>

Attachment: [text/html]
No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.10/43 - Release Date: 7/6/2005
Thread
Stored function problems (Was: UDF failure)Nic Stevens7 Jul
  • Re: Stored function problems (Was: UDF failure)Paul DuBois7 Jul
  • Re: Stored function problems (Was: UDF failure)Peter Brawley7 Jul