zoukankan      html  css  js  c++  java
  • MySQL 存储过程基本函数

    1. 字符串类

      CHARSET(str) //返回字串字符集
      CONCAT (string2 [,... ]) //连接字串
      INSTR (string ,substring ) //返回substring首次在string中出现的位置,不存在返回0
      LCASE (string2 ) //转换成小写
      LEFT (string2 ,length ) //从string2中的左边起取length个字符
      LENGTH (string ) //string长度
      LOAD_FILE (file_name ) //从文件读取内容
      LOCATE (substring , string [,start_position ] ) 同INSTR,但可指定开始位置
      LPAD (string2 ,length ,pad ) //重复用pad加在string开头,直到字串长度为length
      LTRIM (string2 ) //去除前端空格
      REPEAT (string2 ,count ) //重复count次
      REPLACE (str ,search_str ,replace_str ) //在str中用replace_str替换search_str
      RPAD (string2 ,length ,pad) //在str后用pad补充,直到长度为length
      RTRIM (string2 ) //去除后端空格
      STRCMP (string1 ,string2 ) //逐字符比较两字串大小,
      SUBSTRING (str , position [,length ]) //从str的position开始,取length个字符,
      注:mysql中处理字符串时,默认第一个字符下标为1,即参数position必须大于等于1
      TRIM([[BOTH|LEADING|TRAILING] [padding] FROM]string2) //去除指定位置的指定字符
      UCASE (string2 ) //转换成大写
      RIGHT(string2,length) //取string2最后length个字符
      SPACE(count) //生成count个空格

    2. 数字类

      CHARSET(str) //返回字串字符集
      CONCAT (string2 [,... ]) //连接字串
      INSTR (string ,substring ) //返回substring首次在string中出现的位置,不存在返回0
      LCASE (string2 ) //转换成小写
      LEFT (string2 ,length ) //从string2中的左边起取length个字符
      LENGTH (string ) //string长度
      LOAD_FILE (file_name ) //从文件读取内容
      LOCATE (substring , string [,start_position ] ) 同INSTR,但可指定开始位置
      LPAD (string2 ,length ,pad ) //重复用pad加在string开头,直到字串长度为length
      LTRIM (string2 ) //去除前端空格
      REPEAT (string2 ,count ) //重复count次
      REPLACE (str ,search_str ,replace_str ) //在str中用replace_str替换search_str
      RPAD (string2 ,length ,pad) //在str后用pad补充,直到长度为length
      RTRIM (string2 ) //去除后端空格
      STRCMP (string1 ,string2 ) //逐字符比较两字串大小,
      SUBSTRING (str , position [,length ]) //从str的position开始,取length个字符,
      注:mysql中处理字符串时,默认第一个字符下标为1,即参数position必须大于等于1
      TRIM([[BOTH|LEADING|TRAILING] [padding] FROM]string2) //去除指定位置的指定字符
      UCASE (string2 ) //转换成大写
      RIGHT(string2,length) //取string2最后length个字符
      SPACE(count) //生成count个空格

    3. 日期时间类

      CHARSET(str) //返回字串字符集
      CONCAT (string2 [,... ]) //连接字串
      INSTR (string ,substring ) //返回substring首次在string中出现的位置,不存在返回0
      LCASE (string2 ) //转换成小写
      LEFT (string2 ,length ) //从string2中的左边起取length个字符
      LENGTH (string ) //string长度
      LOAD_FILE (file_name ) //从文件读取内容
      LOCATE (substring , string [,start_position ] ) 同INSTR,但可指定开始位置
      LPAD (string2 ,length ,pad ) //重复用pad加在string开头,直到字串长度为length
      LTRIM (string2 ) //去除前端空格
      REPEAT (string2 ,count ) //重复count次
      REPLACE (str ,search_str ,replace_str ) //在str中用replace_str替换search_str
      RPAD (string2 ,length ,pad) //在str后用pad补充,直到长度为length
      RTRIM (string2 ) //去除后端空格
      STRCMP (string1 ,string2 ) //逐字符比较两字串大小,
      SUBSTRING (str , position [,length ]) //从str的position开始,取length个字符,
      注:mysql中处理字符串时,默认第一个字符下标为1,即参数position必须大于等于1
      TRIM([[BOTH|LEADING|TRAILING] [padding] FROM]string2) //去除指定位置的指定字符
      UCASE (string2 ) //转换成大写
      RIGHT(string2,length) //取string2最后length个字符
      SPACE(count) //生成count个空格

  • 相关阅读:
    代码注释技术
    疑难杂症错误解决方法大全
    MD5 加密
    ADO.NET DataReader和DataAdapter的区别
    HTTP协议详解
    web开发常用样式
    Stream 和 byte[] 之间的转换
    Sql 函数大全 (更新中...由难到简
    Web C# 导出Excel 方法总结
    VC++ MFC 如何实现在编辑框中输出具有换行功能的文段 01
  • 原文地址:https://www.cnblogs.com/tannerBG/p/4086383.html
Copyright © 2011-2022 走看看