In Oracle, how do you use two different functions on the same column?
I am trying to use two different string functions (initcap and trim) on one column and I would like it to display only the one column with both functions 开发者_Python百科applied. In general how do you use two or more functions on a single column?
In general, you can nest function calls within function calls, evaluated innermost to outermost:
SELECT INITCAP(TRIM(column)) FROM your_table;
As long as each nested function returns a value of a compatible type, you should be able to apply this to any functions.
For example:
SELECT '|' || INITCAP(TRIM('  abc def ghi  jklmn   ')) || '|' str
  FROM dual;
Results in:
STR
--------------------
|Abc Def Ghi  Jklmn|
Note I concatenated the pipe symbol to illustrate the TRIM of the string.
More to the point here:
SELECT '|' || INITCAP(TRIM('.' FROM '... abc def ghi  jklmn...')) || '|' str FROM dual;
Gives me:
STR
----------------------
| Abc Def Ghi  Jklmn|
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论