oracle sql截取数据长度

oracle

substr(aaabbbbvvvcccc,1,4)='2009'

这是Oracle的用法将xc_qj这个字段的数据从第一位开始截取四位

语法

substr( string,start_position,[ length ] )

说明:
string is the source string.
start_position is the position for extraction. The first position in the string is always 1.
length is optional. It is the number of characters to extract. If this parameter is omitted,substr will return the entire string.


start_position用负数则从右边开始数第几个位置

举例: substr('This is a test',6,2)would return 'is' substr('This is a test',6)would return 'is a test' substr('TechOnTheNet',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'

相关文章

Java Oracle 结果集是Java语言中处理数据库查询结果的一种方...
Java AES和Oracle AES是现代加密技术中最常使用的两种AES加密...
Java是一种广泛应用的编程语言,具备可靠性、安全性、跨平台...
随着移动互联网的发展,抽奖活动成为了营销活动中不可或缺的...
Java和Oracle都是在计算机领域应用非常广泛的技术,他们经常...
Java 是一门非常流行的编程语言,它可以运行于各种操作系统上...