ORACLE-018: ORACLE tip 001 string processing, oracle-018oracle
1. truncate a string
Oracle uses a function substr to intercept a string. The parameter is substr (string, start position, and truncation length ),
For example, if the string 123,112 needs to be removed by a comma, the truncation function is as follows:
Select substr ('1970, ', 0, length ('1970,')-1) from dual;
Result: 123,112
2. Replace string
Function: replace,
As follows:
Select replace ('Think that year, Jin Ge tie Ma, swallowed thousands of miles like a tiger ', 'tiger', 'Wolf ') from dual;
Result: The Golden gotie horse swallowed up like a wolf.
3. String concatenation
Concatenates a string with a pair of | symbols. If a string contains single quotes, double single quotes are used, representing a single quotation mark, and so on.
For example:
Select '(A. SerialID IN (' | 123 | ') or nvl (A. SerialID, '0 '')! = '0') 'from dual;
Result:
(A. SerialID IN (123) or nvl (A. SerialID, '0 ')! = '0 ')
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.