12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Setting up the Globalization Support EnvironmentTable 11–1 (Cont.) Examples of Short Date FormatsCountry Description ExampleChina yyyy-mm-dd 2005-02-28UK dd/mm/yyyy 28/02/2005US mm/dd/yyyy 02/28/2005This topic includes the following parameters:■■NLS_DATE_FORMATNLS_DATE_LANGUAGE11.2.4.1.1 NLS_DATE_FORMAT The NLS_DATE_FORMAT parameter defines the defaultdate format to use with the TO_CHAR and TO_DATE functions. The NLS_TERRITORYparameter determines the default value of NLS_DATE_FORMAT. The value of NLS_DATE_FORMAT can be any valid date format mask. For example:NLS_DATE_FORMAT = "MM/DD/YYYY"The <strong>Oracle</strong> default date format may not always corresponds to the cultural specificconvention used in a given territory. You can utilize the short date and long dateformat in <strong>SQL</strong>, using the 'DS' and 'DL' format masks respectively, to obtain dates ina more localized formats. The examples in this topic show the differences betweensome of the date formats.Example 11–5Using the Default, Short, and Long Date Formats-- Use an ALTER SESSION statement to change the territory to America,-- and the language to AmericanALTER SESSION SET NLS_TERRITORY = America NLS_LANGUAGE = American;-- After the session is altered, select the dates with the format masksSELECT hire_date, TO_CHAR(hire_date,'DS') "Short",TO_CHAR(hire_date,'DL') "Long" FROM employeesWHERE employee_id IN (111, 112, 113);The results of the query in Example 11–5 are similar to the following:HIRE_DATE Short Long--------- ---------- -----------------------------30-SEP-97 9/30/1997 Tuesday, September 30, 199707-MAR-98 3/7/1998 Saturday, March 07, 199807-DEC-99 12/7/1999 Tuesday, December 07, 1999To add string literals to the date format, enclose the string literal with double quotes.Note that when double quotes are included in the date format, the entire value mustbe enclosed by single quotes. For example:NLS_DATE_FORMAT = '"Date: "MM/DD/YYYY'11.2.4.1.2 NLS_DATE_LANGUAGE The NLS_DATE_LANGUAGE parameter specifies thelanguage for the day and month names produced by the TO_CHAR and TO_DATEfunctions. NLS_DATE_LANGUAGE overrides the language that is specified implicitly byNLS_LANGUAGE. NLS_DATE_LANGUAGE has the same syntax as the NLS_LANGUAGEparameter, and all supported languages are valid values.NLS_DATE_LANGUAGE also determines the language used for:■Month and day abbreviations returned by the TO_CHAR and TO_DATE functions11-8 <strong>SQL</strong> <strong>Developer</strong> Online Help

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!