PLSQL single line function and group function detailed (1)

zhaozj2021-02-16  67

Single line string function single line string function is used to operate string data, most of them have one or more parameters, most of which return string

ASCII (

)

C1 is a string, returns a C1 first letter ASCII code, his inverse function is CHR ()

SELECT ASCII ('a') BIG_A, ASCII ('Z') BIG_Z FROM EMPBIG_A BIG_Z65 122

CHR () [nchar_cs]

i is a number, the function returns the character of decimal representation

SELECT CHR (65), CHR (122), CHR (223) from Empchr65 ChR122 CHR223A Z B

CONCAT

,

)

All of C1, C2 are strings, and the function connects C2 to C1, if C1 is null, will return C2. If C2 is NULL, return C1, if C1, C2 is null, then return null. He and the operator || return result

Select Concat ('Slobo', 'Svoboda') UserName from DualUsernameslobo Syoboda

INITCAP

)

C1 is a string. The function returns the first letter of each word to other letters lowercase. Words are limited by spaces, control characters, punctuation.

Select Initcap ('Veni, Vedi, Vici') Ceasar from Dualceasarveni, Vedi, Vici

INSTR

,

[, [,

]]]]])

C1, C2 are both strings, i, j is an integer. The function returns the position where C2 appears at the J2 of C1, and the search begins with the i-th character from C1. When there is no desired character, return 0, if i is a negative number, the search will be performed from right to left, but the calculation of the position is from left to right, I and J of 1.

Select INSTR ('Mississippi', 'I', 3, 3) from Dualinstr ('mississippi', 'i', 3, 3) 11Select Instr ('mississippi', 'i', - 2, 3) from Dualinstr (' Mississippi ',' I ', 3, 3) 2

INSTRB

,

[, i [, j])

Like the INSTR () function, just he returns bytes, for single-byte instib () equal to INSTR ()

Length

)

C1 is a string, returns the length of C1, if C1 is null, then the NULL value will be returned.

SELECT Length ('IPSo Facto') Ergo from Dualergo10

Lengthb (

)

Like Length (), return bytes.

Lower

)

Returns the lowercase character of C, often appears in the WHERE string

SELECT LOWER (ColorName) from itemdetail where lower (colorname) Like '% White%' ColorNamewinterwhite

LPAD

[,

])

C1, C2 are both a string, i is an integer. In the left side of C1, the C2 string is added to the length I, which can repeat multiple times, if i is less than the length of C1, then only returns i so long C1 characters, and the other will be cut off. The default value of C2 is single spacer, see RPAD.

Select LPAD (Answer, 7, ') Padded, Answer Unpadded from Question; Padded Unpadded Yes Yesno Nomaybe Maybeltrim

,

)

Remove the leftmost character in C1, so that the first character is not in C2, if there is no C2, then C1 will not change.

SELECT LTRIM ('mississippi', 'mis') from dualltrppi

RPAD

[,

])

In the right side of C1, the C2 string is added to the length i, which can repeat multiple times, if i is less than the length of C1, then only returns i so long C1 characters, and others will be cut. The default value of C2 is single spacer, and others are similar to LPAD

RTRIM

,

)

Remove the rightmost characters in C1, so that the last character is not in C2, if there is no C2, then C1 will not change.

REPLACE

,

[,

])

Both C1, C2, and C3 are strings, and the function is replaced with C3 to return after C2 in C1.

SELECT Replace ('Uptown', 'Up', 'Down') from DualReplacedowntown

Stbstr

[,

])

C1 is a string, i, j is an integer, start returning a sub-string of j on the I, if j is empty, then the tail of the string is until the tail of the string.

SELECT SUBSTR ('Message', 1, 4) from Dualsubsmess

Substrb

[,

])

The same is substantially the same as SUBSTR, but i, J is based on byte.

Soundex (

)

Return the word similar to the C1 pronunciation

SELECT SOUNDEX ('Dawes') Dawes Soundex ('Daws') Daws, Soundex ('Dawson') from Dualdawes Daws Dawsond200 D200 D250

TRANSLATE

,

,

)

Replace the same character as C2 in C2 in C3

SELECT TRANSLATE ('Fumble', 'Uf', 'AR') Test from DualTextRamble

TRIM ([[[[[[[[[[[[

]

] from C3)

Delete the first, last one, or all of the C3 string.

SELECT TRIM ('Space Padded') Trim from Dual Trimspace Padded

Upper

)

Returns the uppercase of C1, often appears in the WHERE string

Select Name from Dual Where Upper (Name) Like 'Ki%' Nameking

转载请注明原文地址:https://www.9cbs.com/read-17911.html

New Post(0)