substr(sting,m,n) Purpose Returns a portion of char, beginning at character m, n characters long. If m is 0, it is treated as 1. If m is positive, Oracle counts from the beginning of char to find the first character. If m is negative, Oracle counts backwards from the end of char. If n is omitted, Oracle returns all characters to the end of char. If n is less than 1, a null is returned. Floating-point numbers passed as arguments to SUBSTR are automatically converted to integers.
Example 1 SELECT SUBSTR('ABCDEFG',3,4) "Substring" FROM DUAL;
Substring --------- CDEF Example 2 SELECT SUBSTR('ABCDEFG',-5,4) "Substring" FROM DUAL;Substring --------- CDEF
SUBSTRB Syntax substrb(sting,m,n) Purpose The same as SUBSTR, except that the arguments m and n are expressed in bytes, rather than in characters. For a single-byte database character set, SUBSTRB is equivalent to SUBSTR. Floating-point numbers passed as arguments to SUBSTRB are automatically converted to integers.
Example Assume a double-byte database character set: SELECT SUBSTRB('ABCDEFG',5,4.2) "Substring with bytes" FROM DUAL;Substring with bytes -------------------- CD
oracle帮助中有没有可查阅的地方?
返回删除从最左边算起出现在string2中的字符的string1
substr()这个函数还真好用!!!
ltrim()也搞明白了!!!
就是帮助文件还有点点、、、、、、
应该差不多
顺序如下查找即可:
oracle8i\doc\index.htm
Oracle8i Server, Release 8.1.5
Oracle8i SQL Reference
4 Functions
或者在JAVA搜索器中输入functions搜索
substr(sting,m,n)
Purpose
Returns a portion of char, beginning at character m, n characters long. If m is 0, it is treated as 1. If m is positive, Oracle counts from the beginning of char to find the first character. If m is negative, Oracle counts backwards from the end of char. If n is omitted, Oracle returns all characters to the end of char. If n is less than 1, a null is returned. Floating-point numbers passed as arguments to SUBSTR are automatically converted to integers.
Example 1
SELECT SUBSTR('ABCDEFG',3,4) "Substring"
FROM DUAL;
Substring
---------
CDEF
Example 2
SELECT SUBSTR('ABCDEFG',-5,4) "Substring"
FROM DUAL;Substring
---------
CDEF
SUBSTRB
Syntax
substrb(sting,m,n)
Purpose
The same as SUBSTR, except that the arguments m and n are expressed in bytes, rather than in characters. For a single-byte database character set, SUBSTRB is equivalent to SUBSTR. Floating-point numbers passed as arguments to SUBSTRB are automatically converted to integers.
Example
Assume a double-byte database character set: SELECT SUBSTRB('ABCDEFG',5,4.2)
"Substring with bytes"
FROM DUAL;Substring with bytes
--------------------
CD
第一步:先算出所查字符的位置:temp=instr(str1,str2,postion1,position)
第二步:取出想要的字符: str=substr(str1,positon1,postion2)