作者:纸鸢漫天飞舞 | 来源:互联网 | 2023-12-11 11:17
无详细内容MySQLmysqlmysqlDELIMITERmysqlCREATEFUNCTIONmyProc(costDECIMAL(10,2))-RETURNSDECIMAL(1
无详细内容 MySQL mysqlmysql DELIMITER //mysql CREATE FUNCTION myProc (cost DECIMAL(10,2)) - RETURNS DECIMAL(10,2) - - SQL SECURITY DEFINER - - tax: BEGIN - DECLARE order_tax DECIMAL(10,2); - SET order_tax = cost * .05; - RETURN order_tax; -
MySQL
mysql>
mysql> DELIMITER //
mysql> CREATE FUNCTION myProc (cost DECIMAL(10,2))
-> RETURNS DECIMAL(10,2)
->
-> SQL SECURITY DEFINER
->
-> tax: BEGIN
-> DECLARE order_tax DECIMAL(10,2);
-> SET order_tax = cost * .05;
-> RETURN order_tax;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> DELIMITER ;
mysql>
mysql> select myProc(123.45);
+----------------+
| myProc(123.45) |
+----------------+
| 6.17 |
+----------------+
1 row in set, 1 warning (0.00 sec)
mysql>
mysql> drop function myProc;
Query OK, 0 rows affected (0.00 sec)
mysql>
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:php中文网