SQL single-row functions in Oracle databases-continued character Functions

Source: Internet
Author: User

SQL single-row functions in Oracle databases-continued character Functions

I practiced some character functions in the previous blog, and then I went to the next blog to read the relevant materials.
The character function has not been practiced yet. This time, we mainly perform some supplementary exercises on some unused character functions.
Ascii ()
Returns the decimal number corresponding to the specified character. If it is a string, the decimal number of the first letter of the string is returned. [SQL] select ascii ('aaa') A, ascii ('aaa') a, ascii ('0') ZERO,
Ascii ('') space from dual;

Chr ()
Opposite to ascii functions, given integers return specific characters [SQL] select chr (65) x, chr (97) y from dual;
Instr (C1, C2, I, J)
Searches for a specified character in a string, returns the location of the specified character, and only searches once.
C1: string to be searched
C2: string to be searched
I: the start position of the search. The default value is 1. If the result is positive, the search starts from left to right. 0 does not search
J: the location where it appears: tips: the number of times it appears. The default value is 1. If it is negative or 0, the system reports an error,
Example: [SQL] select instr ('oracle hello Oracle hello', 'oracle ',-1, 2) from dual;

Ltrim, rtrim [SQL] select RTRIM ('Hello oracle ', 'oracle') from dual; -- result: hello: delete 'oracle 'on the right'
Soundex
An interesting function returns a string with the same pronunciation as a given string [SQL] create table test_soundex
(
Username varchar2 (20)
);
Insert into test_soundex values ('kiritor ');
Insert into test_soundex values ('kiito ');
Insert into test_soundex values ('kiritor ');
Insert into test_soundex values ('Alex ');
Select username from test_soundex where soundex (username) = soundex ('kiritor ');
There is a TRIM function in the string processing function. The author will find a detailed understanding and practice of the time.

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.