Dates
•All Oracle date values were displayed in the DD-MON-YY format. We can use TO_CHAR function to convert a default format date to one that you specify.
oIs case sensitive
oUse ‘fm’ to remove padded blanks or suppress leading zeros
Select last_name, to_char(hire_date, 'fmDD Month RRRR') HIREDATE
From employees;
Select to_char(salary, '$99,999.00') salary
From employees
Where last_name = 'King';
•All Oracle date values were displayed in the DD-MON-YY format. We can use TO_CHAR function to convert a default format date to one that you specify.
•The format model:
oMust be enclosed by single quotation marks
oIs case sensitive
oUse ‘fm’ to remove padded blanks or suppress leading zeros
| Element | Result |
| YYYY or RRRR | Full year in numbers |
| YEAR | Year spelled out (in English) |
| MM | Two-digit value for month |
| MONTH | Full name of the month |
| MON | Three-letter short form of the month |
| DY | Three-letter short form of the day |
| DAY | Full name of the day |
| DD | Numeric day |
Select last_name, to_char(hire_date, 'fmDD Month RRRR') HIREDATE
From employees;

Numbers
| Element | Result |
| 9 | Represent a number |
| 0 | Forces a zero to be displayed |
| $ | Places a floating dollar sign |
| L | Uses the floating local currency symbol |
| . | Prints a decimal point |
| , | Prints a comma as thousands indicator |
Select to_char(salary, '$99,999.00') salary
From employees
Where last_name = 'King';



0 comments:
Post a Comment