MySQL Forums :: UDF :: CREATE OR REPLACE FUNCTION


Advanced Search

CREATE OR REPLACE FUNCTION
Posted by: Ekrem SABAN ()
Date: June 02, 2007 06:19AM

Hello!

I am using MySQL infrequently, but wanted to write a function I found from the Internet to my MySQL database. As the function is written in ORACLE SQL, it doesn't work, which is principally nothing unusual. I tried to find a PURE MySQL syntax that is HEAVILY hyperlinked WITHOUT any explanation in natural languages. Unfortunately, I couldn't find it.

First of all, I use the mysql under Microsoft Windows [Version 6.0.6000] (i.e. Windows Vista).

> mysql -u ....
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.2.3-falcon-alpha-community-nt MySQL Community Server (GPL)

As I couldn't find a syntax definition for CREATE FUNCTION that helped me, I tried to write the function as follows:

http://www.jlcomp.demon.co.uk/faq/base_convert.html

mysql> CREATE FUNCTION to_base (p_dec NUMBER, p_base NUMBER)
-> RETURNS VARCHAR2
-> BEGIN
-> DECLARE l_str VARCHAR2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL se
for the right syntax to use near 'NUMBER, p_base NUMBER)
RETURNS VARCHAR2
BEGIN
DECLARE l_str VARCHAR2' at line 1
mysql>

I do not know how I can find from "the manual" the right syntax.

It is annoying that it is not possible to find a syntax definition, as it is the case in ORACLE; you can click on every word in the syntax and will find again the syntax definition of this part. If you click on the "body" of the function, you would be able to find the syntax of a DECLARE statement, and so on...

Thank you for any helpful information!

Options: ReplyQuote


Subject Views Written By Posted
CREATE OR REPLACE FUNCTION 39385 Ekrem SABAN 06/02/2007 06:19AM
Re: CREATE OR REPLACE FUNCTION 15957 graeme gerber 07/18/2007 08:13AM
Re: CREATE OR REPLACE FUNCTION 7551 William Chiquito 07/18/2007 08:42AM
Re: CREATE OR REPLACE FUNCTION 7285 koustubh dave 12/06/2007 08:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.