Home > Database > Mysql Tutorial > body text

利用 mysql.proc 表来获取基础数据信息

PHPz
Release: 2019-02-26 17:14:12
Original
3562 people have browsed it

MySQL mysqlmysqlmysql DELIMITER //mysqlmysql CREATE FUNCTION myFunction (item_sum DECIMAL(10,2)) - RETURNS DECIMAL(10,1) - BEGIN - - - RETURN ROUND(item_sum,1); - - END - //Query OK, 0 rows affected (0.00 sec)mysql DELIMITER ;mys
Copy after login

相关mysql视频教程推荐:《mysql教程

mysql>
mysql>
mysql> DELIMITER //
mysql>
mysql> CREATE FUNCTION myFunction (item_sum DECIMAL(10,2))
    -> RETURNS DECIMAL(10,1)
    -> BEGIN
    ->
    ->
    -> RETURN ROUND(item_sum,1);
    ->
    -> END
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> DELIMITER ;
mysql>
mysql> select myFunction(123.12);
+--------------------+
| myFunction(123.12) |
+--------------------+
|              123.1 |
+--------------------+
1 row in set (0.00 sec)

mysql>
mysql>
mysql>
mysql> SELECT * FROM mysql.proc WHERE name = 'myFunction'\G
*************************** 1. row ***************************
              db: test
            name: myFunction
            type: FUNCTION
   specific_name: myFunction
        language: SQL
 sql_data_access: CONTAINS_SQL
is_deterministic: NO
   security_type: DEFINER
      param_list: item_sum DECIMAL(10,2)
         returns: decimal(10,1)
            body: BEGIN
RETURN ROUND(item_sum,1);
END
         definer: root@localhost
         created: 2007-07-23 18:58:39
        modified: 2007-07-23 18:58:39
        sql_mode:
         comment:
1 row in set (0.00 sec)

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

mysql>
mysql>      	           	      	
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template