902
1 record(s) selected.
A.4 Sample code for GREATEST function
Example A 17 is a set of UDF examples emulating the behavior of MySQL's
GREATEST function. The various UDFs accept input parameters in
varchar
and
from 2 to 10 input parameters.
Example: A 17 User defined functions to map GREATEST
DB2 UDB UDF(User Defined Function) Samples for Migration
2001/08/28, 08/29
Name of UDF: GREATEST (P1 VarChar(254), P2 VarChar(254), ...)
Used UDF: None
Description: Returns greatest value of list of data.
Author: TOKUNAGA, Takashi
CREATE FUNCTION GREATEST (P1 VarChar(254), P2 VarChar(254))
RETURNS VarChar(254)
LANGUAGE SQL
SPECIFIC GREATESTOracle2
DETERMINISTIC
CONTAINS SQL
NO EXTERNAL ACTION
RETURN
CASE
WHEN P1 >= P2 THEN P1
ELSE P2
END
;
GREATEST function with three parameters
CREATE FUNCTION GREATEST (P1 VarChar(254), P2 VarChar(254), P3 VarChar(254))
RETURNS VarChar(254)
346
MySQL to DB2 UDB Conversion Guide
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved