create a function use in MySQL?

Posted on 2000-01-17
Medium Priority
Last Modified: 2010-04-22
I want to create a function
it do some calculate and return one
row of records;
now I want to use it like:
"select MyFuction(a,b) from tbl" just like "select MAX() from tbl"
How can I do it?
give me the important souce code please
Question by:SonicYouth

Expert Comment

ID: 2368029

Expert Comment

ID: 2373357
I don't know much about MySQL, but there is some good looking doc. at http://www.mysql.com/download_documents.html

Accepted Solution

s_franklin earned 100 total points
ID: 2377833
MySQL does not support stored functions and procedures. You will not be able to achieve what you're looking for server-side, and instead will have to look at how to get the functionality from whatever environment interacts with MySQL. Obviously you can code functions in perl, C++, PHP, etc that would do what you want. These functions could interact with the data on the MySQL database and return the result you require. This is discussed in the MySQL reference manual in the "Functionality missing from MySQL" section:


If you are doing this from a web server I would recommend that you look at PHP (http://www.php3.net). It has excellent integration with MySQL for doing programmatic manipulation of data as functions similar to what you describe.



Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question