•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 375,202 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,355 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1404 | Replies: 17
![]() |
| |
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,924
Reputation:
Rep Power: 9
Solved Threads: 221
Something like this? http://en.oreilly.com/mysql2008/publ...ule/detail/128
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
•
•
Join Date: Apr 2008
Posts: 290
Reputation:
Rep Power: 1
Solved Threads: 39
hi,
MySQL does not support user defined functions (UDF) in the sense of standard SQL, which, for example, allow such a declaration in its own PSM language:
In MySQL kind of UDF can be defined as a plain C program. Such C-coded program must be linked dynamically, there is also special header handling. This approach is rather complicated and error prone. Once Borland's interbase had had same approach.
brs,
tesu
MySQL does not support user defined functions (UDF) in the sense of standard SQL, which, for example, allow such a declaration in its own PSM language:
sql Syntax (Toggle Plain Text)
CREATE FUNCTION avgg(*) returns float ap float SELECT avg(price) FROM goods INTO ap RETURN ap -- usage SELECT id FROM goods WHERE price < avgg(*)
brs,
tesu
•
•
Join Date: Apr 2008
Posts: 290
Reputation:
Rep Power: 1
Solved Threads: 39
well tanha,
though i ve written UDFs for Sybase Databases a good many times, it s rather time-consuming doing that within MySQL. You may have a look at
http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html
to get an impression of the hard work to be done for it (as opposed to the convenient way when programming UDF by using SQL1999 standards).
krs,
tesu
though i ve written UDFs for Sybase Databases a good many times, it s rather time-consuming doing that within MySQL. You may have a look at
http://dev.mysql.com/doc/refman/5.0/en/adding-udf.html
to get an impression of the hard work to be done for it (as opposed to the convenient way when programming UDF by using SQL1999 standards).
krs,
tesu
•
•
Join Date: Apr 2008
Posts: 290
Reputation:
Rep Power: 1
Solved Threads: 39
Here is an UDF example which runs on SQL Anywhere 9:
I use select upper(substring(... to capitalize first char. You can also use this select within MySQL because all char functions are also available there.
sql Syntax (Toggle Plain Text)
CREATE FUNCTION upperFirstChar(IN isc VARCHAR(1000)) RETURNS VARCHAR(1000) /* Usage: select upperFirstChar('hello!') AS 'Capitalized 1st Character'; Result: Capitalized 1st Character ------------------------- Hello! */ BEGIN DECLARE rtc VARCHAR(1000); SELECT UPPER(SUBSTRING(isc, 1, 1)) + LOWER(SUBSTRING(isc, 2, LENGTH(isc)-1)) INTO rtc; RETURN rtc; END;
•
•
Join Date: Aug 2007
Posts: 141
Reputation:
Rep Power: 0
Solved Threads: 0
Hi tesuji,
Hope doing fine, I tried much, but still I am lost how to write UDF for MySQL, I don't like to write complex function now, I need just one sample example written in C/C++, and then use that in MySQL working...
I need this example and guide as my start point...
Therefore kindly request you, if possible post here a sample UDF written in C, and then the steps how to use of that in MySQL...
That would be very kind of you...
Thanks
Hope doing fine, I tried much, but still I am lost how to write UDF for MySQL, I don't like to write complex function now, I need just one sample example written in C/C++, and then use that in MySQL working...
I need this example and guide as my start point...
Therefore kindly request you, if possible post here a sample UDF written in C, and then the steps how to use of that in MySQL...
That would be very kind of you...
Thanks
Last edited by tanha : May 14th, 2008 at 1:15 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Other Threads in the MySQL Forum
- Previous Thread: traveldb script
- Next Thread: postgreSQL downloafِ



Hybrid Mode