ORACLE functions (1)

Source: Internet
Author: User
12345678910111213141516 ASCII (x1) [function]: returns the ASCII value of the leftmost character of a character expression. [Parameter]: x1, character expression [Return]: Numeric [Example] SQLselectascii (A) A, ascii (a) a, ascii () space, ascii (Display) hzfromdual; AASPACE

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ASCII (x1) [function]: returns the ASCII value of the leftmost character of a character expression. [Parameter]: x1, character expression [Return]: Numeric [Example] SQL select ascii ('A') A, ascii ('A') A, ascii ('') space, ascii ('shit') hz from dual; A SPACE

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

ASCII (x1)

[Function]: returns the ASCII value of the leftmost character of a character expression.

[Parameter]: x1, Character Expression

[Return]: numeric type

[Example]

SQL> select ascii ('A') A, ascii ('A') A, ascii ('') space, ascii ('shit') hz from dual;

A space hz

------------------------------------

65 97 32 51902

[Note] In the ASCII () function, strings of pure numbers do not need to be enclosed by '', But strings containing other characters must be enclosed by''. Otherwise, an error occurs.

If the leftmost side is a Chinese character, only the ASCII code of the leftmost half side of the Chinese character is used.

[Reciprocal function]: chr ()

?

1

CHR (n1) [function]: converts an ASCII code to a character. [Parameter]: n1, 0 ~ 255, integer [Return]: Random [Example] SQL> select chr (54740) zhao, chr (65) chr65 from dual; ZH C ---zhao A [reciprocal function]: ASCII

?

1

CONCAT (c1, c2) [function] connects two strings [parameter] c1, c2 struct expression [Return] struct: c1 | c2 [Example] select concat ('010-', '000000') |' to 23' Gao Qian's competing phone number from dual; Gao Qian's competing phone number -------------- 010-88888888 to 23

?

1

INITCAP (c1) [function] returns a string and converts the first letter of the string to uppercase, And the other letters to lowercase; [parameter] c1 plain expression [Return] plain type [Example] SQL> select initcap ('Smith abc abc') upp from dual; UPP ----- smith aBC Abc

?

1

LOWER (c1) [function]: Convert all strings to lowercase [parameter]: c1, character expression [Return]: character type [Example] SQL> select lower ('aabbccdd ') aaBbCcDd from dual; AABBCCDD -------- aabbccdd [similar] UPPER () converts all strings into uppercase.

?

1

UPPER (c1) [function] converts all strings to uppercase [parameter] c1, character expression [Return] character type [Example] SQL> select upper ('aabbccdd') upper from dual; UPPER -------- AABBCCDD [similar] LOWER () converts all strings to lowercase letters

?

1

NLS_INITCAP (x [, y]) [function] returns a string and converts the first letter of the string to uppercase, And the other letters to lowercase. [parameter] x-character expression [parameter] Nls_param is optional, to query data-level NLS settings: select * from nls_database_parameters; for example, specify the sorting method (nls_sort = ). Nls_sort = SCHINESE_RADICAL_M (radical, stroke) nls_sort = SCHINESE_STROKE_M (stroke, radical margin (pinyin) [Return] stroke type [Example] select nls_initcap ('AB cde') "test ", nls_initcap ('a c B d E', 'nls _ sort = SCHINESE_PINYIN_M ') "test1" from dual; Return: 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 dual;

?

1

NLS_LOWER (x [, y]) [function] returns a string and converts it to lowercase. [parameter] x-ray expression [parameter] Nls_param (optional, specify the sorting method (nls_sort = ). SCHINESE_RADICAL_M (radical, stroke) SCHINESE_STROKE_M (stroke, radical SCHINESE_PINYIN_M (pinyin) [Return] Random type [Example] select nls_LOWER ('AB cde') "test ", nls_LOWER ('a c B d E', 'nls _ sort = SCHINESE_PINYIN_M ') "test1" from dual; Return: AB cde, a c B d e

?

1

NLS_UPPER (x [, y]) [function] returns a string and converts the string to uppercase. [parameter] x regular expression [parameter] Nls_param (optional, specify the sorting method (nls_sort = ). SCHINESE_RADICAL_M (radical, stroke) SCHINESE_STROKE_M (stroke, radical SCHINESE_PINYIN_M (pinyin) [Return] Random type [Example] select NLS_UPPER ('AB cde') "test ", NLS_UPPER ('a c B d E', 'nls _ sort = SCHINESE_PINYIN_M ') "test1" from dual; Return: AB cde, a c B D e

?

1

INSTR (C1, C2 [, I [, J]) [function] searches for a specified character in a string and returns the location where the specified character is found; [note] multi-byte characters (Chinese characters, full-angle characters, etc.) are calculated based on 1 character. [parameter] Start position of the string C2 to be searched by C1, the default value is the position where J appears for the first time. The default value is 1 [Return] value [Example] select instr ('oracle traning', 'A', 1, 2) instring from dual; return: 9 [Example] select instr ('a software company in Chongqing ', 'mou',), Region B ('a software company in Chongqing', 'mou) instring from dual; Return: 3, 5

?

1

INSTRB (C1, C2 [, I [, J]) [function] searches for a specified character in a string and returns the location where the specified character is found; [note] multi-byte characters (Chinese characters, full-angle characters, etc.) are calculated by two characters. [parameter] the start position of the string C2 to be searched by C1, the default value is the position where J appears for the first time. The default value is 1 [Return] value [Example] select instr ('a software company in Chongqing ', 'mou ), instrb ('a software company in Chongqing ', 'mou',) instring from dual; return:

?

1

LENGTH (c1) [function] returns the LENGTH of a string. [description] multibyte characters (Chinese characters, fullwidth characters, etc ), calculate the [parameter] C1 string [Return] numeric type [Example] SQL> select length ('gao Qian competition'), length ('hai Ding district, Beijing '), length ('Beijing TO_CHAR ') from dual; length ('high Qian jing') length ('Beijing Hite area') length ('Beijing TO_CHAR ') ---------------------------- ------------------------ 3 6 9

?

1

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.