Sponsored Links
Oracle TO_CHAR(),TRANSLATE(),TRIM(),TRUNC()
Oracle TO_CHAR Convert to character String
select TO_CHAR(sysdate) from dual
result: 14-MAR-08
select TO_CHAR(sysdate,'DD-Mon-YYYY') from dual
result: 14-Mar-2008
select TO_CHAR(sysdate,'DD-Mon-YYYY HH24:mi:ss') from dual
14-Mar-2008 15:40:45
Oracle TRANSLATE('char','search_str','replace_str')
Replace every occurrence of search_str with replace_str
unlike REPLACE() if replace_str is NULL the function returns NULL
Oracle TRANSLATE (text USING charset)
Convert text into a specific character set
Use this instead of CONVERT() if either the input or output datatype
is NCHAR or NVARCHAR2.
TRIM(LEADING|TRAILING|BOTH trim_char FROM trim_source)
Returns trim_source as a VARCHAR2 with leading/trailing items removed
trim_char defaults to a space ' ' but may be numeric or char 'A'
TRUNC(i,d) i truncated to d decimal places (d defaults to 0)
select TRUNC(12.52) from dual
Result:12
TRUNC(date,fmt)
date truncated to nearest fmt
select TRUNC(sysdate) from dual - if you trunc the date , it will set hours and minuts to 00:00
Page 1
|
|