CREATE FUNCTION LEAST (P1 VarChar(254), P2 VarChar(254), P3 VarChar(254), P4
VarChar(254)
, P5 VarChar(254))
RETURNS VarChar(254)
LANGUAGE SQL
SPECIFIC LEASTOracle5
DETERMINISTIC
CONTAINS SQL
NO EXTERNAL ACTION
RETURN
CASE
WHEN P1 <= P2
THEN CASE
WHEN P1 <= P3
THEN CASE
WHEN P1 <= P4
THEN CASE
WHEN P1 <= P5 THEN P1
ELSE P5
END
ELSE CASE
WHEN P4 <= P5 THEN P4
ELSE P5
END
END
ELSE CASE
WHEN P3 <= P4
THEN CASE
WHEN P3 <= P5 THEN P3
ELSE P5
END
ELSE CASE
WHEN P4 <= P5 THEN P4
ELSE P5
END
END
END
ELSE CASE
WHEN P2 <= P3
THEN CASE
WHEN P2 <= P4
THEN CASE
WHEN P2 <= P5 THEN P2
ELSE P5
END
ELSE CASE
WHEN P4 <= P5 THEN P4
ELSE P5
356
MySQL to DB2 UDB Conversion Guide