e asked in 電腦與網際網路程式設計 · 1 decade ago

SQL 日期語法轉換的語法(由Oracle轉出資料)

目前要將Oracle上的資料用SQL 撈出資料,可是日期呈現的是"07-6月 -05"

,我要怎樣轉成 2005/06/07 的格式呢?

2 Answers

Rating
  • Anonymous
    1 decade ago
    Favorite Answer

    The TO_CHAR function converts a date value to character representations. You can use it within SQL statements or PL/SQL modules to present date values in more useful formats. The syntax of the TO_CHAR function used to format date values is shown here:

    TO_CHAR(date_value, 'format mask')

    The format mask specifies the format of the date when it is returned by the function. You can specify the output format any way you want by using valid date format models.

  • 1 decade ago

    看你要轉成什麼格式的日期,下列是用TO_CHAR的方法

    TO_CHAR(欄位名稱,'YYYY/MM/DD')

    Source(s): 自己
Still have questions? Get your answers by asking now.