zoukankan      html  css  js  c++  java
  • mysql function

    mysql 自定义函数的使用


    先查看函数功能是否开启:show variables like '%func%';

    若是未开启则:SET GLOBAL log_bin_trust_function_creators=1;

    关闭则是:SET GLOBAL log_bin_trust_function_creators=0;

    @1 创建

    DROP function IF EXISTS myzrz;


    delimiter //

    create function myzrz(x int , y int )

    returns int
    begin
    declare a SMALLINT UNSIGNED DEFAULT 20;
    declare b SMALLINT UNSIGNED DEFAULT 10;
    return a+b;

    end

    //
    DROP function IF EXISTS myzrz;
    说明 语法格式
    create function 函数名称 (接收变量名 变量类型,接收变量名 变量类型 )

    returns int // 指定返回类型 此处returns 注意

    begin
    declare 局部变量名1 变量类型 default 默认值 ;
    declear 局部变量名2 变量类型 default 默认值 ; //注意声明多个变量要用多个declare 语句切之间用分号隔开


    此处定义方法体


    return 返回值;

    end //结束Begin - end 方法体


    删除 drop function 自定义函数名

    显示 创建自定义函数的语句 show create function 自定义函数名 ;


    查看有哪些自定义函数 show function status;


    修改自定义函数 alert function

    先写这些  以后用到再补充

  • 相关阅读:
    eNSP进行配置网络模拟网络联通
    Labview上使用mydaq采集数据
    Labview实现计算器
    matlab小记(四)
    matlab小记(三)
    matlab小记(二)
    matlab小记(一)
    Python中map和reduce
    Python 如何调用自定义函数
    《机电传动控制》第十一周作业(二)
  • 原文地址:https://www.cnblogs.com/anyehome/p/7967486.html
Copyright © 2011-2022 走看看