Hi.
I want to know how it is possible to write your own function "UDF" in MySQL? and how use that UDF in MySQL?
tanha
-2
Posting Whiz in Training
Recommended Answers
Jump to PostSomething like this? http://en.oreilly.com/mysql2008/public/schedule/detail/128
Jump to Posthi,
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:create function avgg(*) returns float ap float select avg(price) from goods into ap return ap -- usage select id from …
Jump to Postwell 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 …
Jump to PostHere is an UDF example which runs on SQL Anywhere 9:
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; …
Jump to PostHi tanha,
the given UDF should only be an example on how to program UDF using SQL Standard features. Since SQL 2003 (not 1999) there are UDFs defined, and they can be created with a rather new procedural language called PSM (Persistent Storage Moduls now part of SQL Standard, somehow …
All 17 Replies
tanha
-2
Posting Whiz in Training
peter_budo
2,532
Code tags enforcer
Team Colleague
Featured Poster
tesuji
135
Master Poster
tanha
-2
Posting Whiz in Training
tesuji
135
Master Poster
tesuji
135
Master Poster
tanha
-2
Posting Whiz in Training
tanha
-2
Posting Whiz in Training
tesuji
135
Master Poster
tanha
-2
Posting Whiz in Training
tanha
-2
Posting Whiz in Training
tanha
-2
Posting Whiz in Training
tanha
-2
Posting Whiz in Training
tanha
-2
Posting Whiz in Training
peter_budo
2,532
Code tags enforcer
Team Colleague
Featured Poster
tesuji
135
Master Poster
tanha
-2
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.