Home > Database > Mysql Tutorial > sql substr()函数用法详细

sql substr()函数用法详细

WBOY
Release: 2016-06-07 17:46:15
Original
4082 people have browsed it

文章是介绍了oracle中和plsql中的substr()字符串截取函数的用法,有需要的同学可以参考一下。

文章是介绍了oracle中和plsql中的substr()字符串截取函数的用法,有需要的同学可以参考一下。

语法

 代码如下 复制代码

substr( string, start_position, [ length ] )


字符串是源字符串。

start_position是提取的位置。字符串中的第一个位置始终为1。

length  可选的。它是提取的字符数。如果省略该参数,SUBSTR将返回整个字符串。

Applies To:

 代码如下 复制代码

Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g


实例

 代码如下 复制代码

substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
substr('TechOnTheNet', 1, 4) would return 'Tech'
substr('TechOnTheNet', -3, 3) would return 'Net'
substr('TechOnTheNet', -6, 3) would return 'The'
substr('TechOnTheNet', -8, 2) would return 'On'

Related labels:
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