Call buildin math function in your procedure : Buildin Functions « Procedure Function « SQL / MySQL






Call buildin math function in your procedure

  
mysql> delimiter $$
mysql>
mysql>
mysql> CREATE PROCEDURE myProc()
    -> BEGIN
    ->     DECLARE my_big_integer     int DEFAULT 2;
    ->
    ->     SET my_big_integer=POWER(my_big_integer,3);
    ->
    ->     select my_big_integer;
    -> END$$
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql>
mysql> call myProc();
+----------------+
| my_big_integer |
+----------------+
|              8 |
+----------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> drop procedure myProc;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>

          
  








Related examples in the same category

1.Check MySQL version
2.Use Build-in SUM function in a procedure
3.Using String functions in a user-defined function
4.Return the file size by using the LOAD_FILE function
5.An example of a LOOP: test(n) returns once again a string with n asterisks.