Oracle character function (i)

Source: Internet
Author: User
Tags character set chr numeric lowercase sort

1 2 3 4 5 6 7 8 9 10 11 12 13 14-15 16 ASCII (x1) "feature": Returns the ASCII value of the leftmost character of a character expression.   Parameters: x1, character expression "return": Numeric "Example" sql> Select ASCII (' a ') a,ascii (' A ') a,ascii (') space,ascii (' Show ') Hz from dual; A a space Hz------------------------------------65 97 32 51902 "description   "In the ASCII () function, a string of pure digits can be used without the word", but a string with other characters must be "enclosed", otherwise there will be an error. If the leftmost is Chinese character, the ASCII "reciprocal function" of the left half character of the Chinese character is only taken: Chr ()

?

1 CHR (N1) "Features": converts ASCII code to characters. "Parameters": N1, 0 ~ 255, integer "return": Character type "Example" sql> Select Chr (54740) ZHAO,CHR () chr65 from dual; En C---Zhao A "Mutual inverse function": ASCII

?

1 CONCAT (C1,C2) "function" Connection two string "argument" c1,c2 character expression "return" character type: c1| | C2 "Example" Select Concat (' 010-', ' 88888888 ') | | Turn 23 ' Gao Hu bid from dual; Gao Hu Telephone----------------010-88888888 ext. 23

?

1 Initcap (C1) "function" returns the string and capitalizes the first letter of the string, with the other letter lowercase; The argument C1 character expression returns the character type example sql> select Initcap (' Smith abc abc ') Upp from dual; UPP-----Smith ABC abc

?

1 LOWER (C1) "Features": Converts the string to lowercase "parameters": C1, character expression "return": Character "Sample" Sql> Select LOWER (' AABBCCDD ') AABBCCDD from dual; AABBCCDD--------AABBCCDD "homogeneous" UPPER () to capitalize all the strings.

?

1 UPPER (C1) "function" converts the string to all uppercase "argument" C1, character expression "returns" character type "Example" sql> Select UPPER (' AABBCCDD ') UPPER from dual; UPPER--------AABBCCDD "homogeneous" LOWER () to lowercase all strings

?

1 Nls_initcap (X[,y]) "function" returns the string and capitalizes the first letter of the string, with the other letter lowercase; parameter x character expression "parameters" Nls_param optional, querying the Nls settings at the data level: SELECT * from Nls_database_parameters; For example: Specifies how the sort is to be sorted (nls_sort=). Nls_sort=schinese_radical_m (radical, stroke) nls_sort=schinese_stroke_m (stroke, radical schinese_pinyin_m (phonetic)) "return" character "sample" Select Nls_ Initcap (' ab CDE ') "Test", Nls_initcap (' a C b d e ', ' nls_sort= schinese_pinyin_m ') "test1" from dual; Back: Ab CDE, A c b d e select Nls_initcap (' Ab cde ') "Test", Nls_initcap (' A c b d e ', ' Nls_language=american ') "Test1" from Du Al

?

1 Nls_lower (X[,y]) "function" returns a string and turns the string to lowercase; The parameter X-character expression argument Nls_param optional, specifying how to sort (nls_sort=). Schinese_radical_m (radical, stroke) schinese_stroke_m (stroke, radical schinese_pinyin_m (phonetic)) "Return to Character sample" Select Nls_lower (' ab CDE ') "Test ", Nls_lower (' a C b d e ', ' nls_sort= schinese_pinyin_m ')" test1 "from dual; Back: AB cde,a c b d E

?

1 Nls_upper (X[,y]) "function" returns a string and converts the string to uppercase; The parameter X-character expression argument Nls_param optional, specifying how to sort (nls_sort=). Schinese_radical_m (radical, stroke) schinese_stroke_m (stroke, radical schinese_pinyin_m (phonetic)) "Return to Character sample" Select Nls_upper (' ab CDE ') "Test ", Nls_upper (' a C b d e ', ' nls_sort= schinese_pinyin_m ')" test1 "from dual; Back: AB cde,a C B D E

?

1 INSTR (C1,c2[,i[,j]]) "function" searches for a specified character in a string, returning the location of the specified character; "description" Multi-Byte character (Chinese character, full-angle characters, and so on, 1 characters for the "parameters" C1 the searched string C2 The starting position of the string I search that you want to search, the default is 1 J, the default is 1 "return" value "Sample" Select InStr (' Oracle Trani Ng ', ' ra ', 1,2) instring from dual; Back: 9 "Example" Select InStr (' A software company in Chongqing ', ' a ', 1,1 '), INSTRB (' A software company in Chongqing ', ' a ', 1,1) instring from dual; return: 3,5

?

1 INSTRB (C1,c2[,i[,j]]) "function" searches for a specified character in a string, returning the location of the specified character; "description" Multibyte characters (kanji, full-width characters, etc.) computes the "parameter" by 2 characters C1 the searched string C2 The starting position of the string I search that you want to search, the default is 1 J, the default is 1 "return" Numeric "Example" Select InStr (' Chongqing software company ', ' a ' , 1,1), INSTRB (' A software company in Chongqing ', ' a ', 1,1 ') instring from dual; return: 3,5

?

1 Length (C1) "function" returns the lengths of the string; "description" multibyte (kanji, full-width, etc.), 1-character argument C1 string "Returns the numeric Example" sql> Select Length (' Gao Hu competition '), Length (' Beijing Sea ingot area '), Length (' Peking To_char ') from dual; Length (' Gao Hu competition ') Length (' Beijing To_char ')-------------------------------------------------------------3 6 9

?

1 Length (C1) "function" returns the lengths of the string; Description multibyte characters (kanji, full-width characters, etc.), 2-character argument C1 string returns the numeric sample sql> Select Length (' Gao Hu competition '), LENGTHB (' Gao Hu competition ') from dual; Length (' Gao Hu competition ') LENGTHB (' Gao Hu competition ')---------------------------------3 6

?

1 LENGTHC (C1). LENGTH2 (C1). LENGTH4 (C1) "function" returns the length of the string; "description" multibyte (kanji, full-width, etc.), 1-character argument C1 string "Returns the numeric Example" sql> Select Length (' Gao Hu competition '), Length (' Beijing Sea ingot area '), Length (' Peking To_char ') from dual; In Oracle's character function, there is a kind of function is the function that asks for the character length, length, LENGTHB, LENGTHC, length2, length4 several functions are more commonly used is length, LENGTHB. What they mean is that the length function returns the number of characters, using the given character set to calculate the number of characters LENGTHB gives the byte lengthc of the string using pure Unicode LENGTH2 using the UCS2 LENGTH4 use UCS4 The following are some examples: Select length (' Hello ') from dual; 2 Select lengthb (' Hello '), lengthc (' Hello '), length2 (' Hello '), Length4 (' Hello ') from dual;

?

1

?

1
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.