将日期格式化为单词

Formatting Dates into Words

我想显示部门员工工作二十周年的日期。这是我的:

    select e.last_name, e.department_id, add_months(min(h.start_date), 240) as "20 Year Anniversary"
    from employees e
    inner join job_history h
    on h.employee_id = e.employee_id
    group by e.department_id, e.last_name;

这显示:

    Last_Name   Department_ID    20 Year Anniversary
  1 Hartstein              20    17-FEB-16
  2 Bob                    90    21-SEP-09

等等。但我想以这种格式显示日期:1 月 21 日,19 日 82 日。我将如何格式化日期?

我想这就是您要找的。 TO_CHAR 日期 formatting.Check 出自 oracle 官方文档页面

http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions180.htm

select e.last_name, e.department_id,to_char(add_months(min(h.start_date), 240),'Month fmDdsp, Year') as "20 Year Anniversary"
    from employees e
    inner join job_history h
    on h.employee_id = e.employee_id
    group by e.department_id, e.last_name;