From: Peter Brawley Date: July 7 2005 7:00pm Subject: Re: Stored function problems (Was: UDF failure) List-Archive: http://lists.mysql.com/mysql/186311 Message-Id: <42CD7BD8.8020802@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======AVGMAIL-42CD7BD851B2=======" --=======AVGMAIL-42CD7BD851B2======= Content-Type: multipart/alternative; boundary=------------020407020606030903030907 --------------020407020606030903030907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 > > --------------020407020606030903030907 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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
--------------020407020606030903030907-- --=======AVGMAIL-42CD7BD851B2======= Content-Type: text/plain; x-avg=cert; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" 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 --=======AVGMAIL-42CD7BD851B2=======--