1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| --------------
START TRANSACTION
--------------
--------------
DROP DATABASE IF EXISTS `base`
--------------
--------------
CREATE DATABASE IF NOT EXISTS `base`
DEFAULT CHARACTER SET `latin1`
DEFAULT COLLATE `latin1_general_ci`
--------------
--------------
CREATE FUNCTION `puissance` (_x integer, _y integer)
RETURNS integer
DETERMINISTIC
NO SQL
BEGIN
return exp(_y * log(_x));
END
--------------
--------------
select `puissance`(2,5)
--------------
+------------------+
| `puissance`(2,5) |
+------------------+
| 32 |
+------------------+
--------------
COMMIT
--------------
Appuyez sur une touche pour continuer... |
Partager