Oracle Functions
String functions perform various character manipulations. They operate on character strings.
Function | Example | Description |
---|---|---|
Ascii
| Ascii('a') |
Converts a single character string to its corresponding ASCII code, between 0 and 255. If the character expression evaluates to multiple characters, the ASCII code corresponding to the first character in the expression is returned.
|
Bit_Length
| Bit_Length('abcdef') |
Returns the length, in bits, of a specified string. Each Unicode character is 2 bytes in length (equal to 16 bits).
|
Char
| Char(35) |
Converts a numeric value between 0 and 255 to the character value corresponding to the ASCII code.
|
Char_Length
| Char_Length(Customer_Name) |
Returns the length, in number of characters, of a specified string. Leading and trailing blanks aren’t counted in the length of the string.
|
Concat
| SELECT DISTINCT Concat ('abc', 'def') FROM employee |
Concatenates two character strings.
|
Insert
| SELECT Insert('123456', 2, 3, 'abcd') FROM table |
Inserts a specified character string into a specified location in another character string.
|
Left
| SELECT Left('123456', 3) FROM table |
Returns a specified number of characters from the left of a string.
|
Length
| Length(Customer_Name) |
Returns the length, in number of characters, of a specified string. The length is returned excluding any trailing blank characters.
|
Locate
| Locate('d' 'abcdef') |
Returns the numeric position of a character string in another character string. If the character string isn’t found in the string being searched, the function returns a value of 0.
|
LocateN
| Locate('d' 'abcdef', 3) |
Like Locate, returns the numeric position of a character string in another character string. LocateN includes an integer argument that enables you to specify a starting position to begin the search.
|
Lower
| Lower(Customer_Name) |
Converts a character string to lowercase.
|
Octet_Length
| Octet_Length('abcdef') |
Returns the number of bytes of a specified string.
|
Position
| Position('d', 'abcdef') |
Returns the numeric position of
strExpr1 in a character expression. If strExpr1 isn’t found, the function returns 0. |
Repeat
| Repeat('abc', 4) |
Repeats a specified expression
n times. |
Replace
| Replace('abcd1234', '123', 'zz') |
Replaces one or more characters from a specified character expression with one or more other characters.
|
Right
| SELECT Right('123456', 3) FROM table |
Returns a specified number of characters from the right of a string.
|
Space
| Space(2) |
Inserts blank spaces.
|
Substring
| Substring('abcdef' FROM 2) |
Creates a new string starting from a fixed number of characters into the original string.
|
SubstringN
| Substring('abcdef' FROM 2 FOR 3) |
Like Substring, creates a new string starting from a fixed number of characters into the original string.
SubstringN includes an integer argument that enables you to specify the length of the new string, in number of characters.
|
TrimBoth
| Trim(BOTH '_' FROM '_abcdef_') |
Strips specified leading and trailing characters from a character string.
|
TrimLeading
| Trim(LEADING '_' FROM '_abcdef') |
Strips specified leading characters from a character string.
|
TrimTrailing
| Trim(TRAILING '_' FROM 'abcdef_') |
Strips specified trailing characters from a character string.
|
Upper
| Upper(Customer_Name) |
Converts a character string to uppercase.
|
0 comments:
Post a Comment