Single statement function : Function : Procedure Function MySQL TUTORIALS


MySQL TUTORIALS » Procedure Function » Function »

 

Single statement function


mysql>
mysql> DELIMITER //
mysql> CREATE FUNCTION calc_tax (cost DECIMAL(10,2)) RETURNS DECIMAL(10,2)
    -> RETURN cost * .05
    -> //
Query OK, rows affected (0.00 sec)

mysql>
mysql> DELIMITER ;
mysql>
mysql> select calc_tax(123.123);
+-------------------+
| calc_tax(123.123|
+-------------------+
|              6.16 |
+-------------------+
row in set, warnings (0.00 sec)

mysql>
mysql> drop function calc_tax;
Query OK, rows affected (0.00 sec)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Procedure Function
» Function