Sokrates on Oracle

Learning foreign languages with Oracle SQL

Posted by Matthias Rogel on 23. March 2012

with y as
(
   select 
      add_months(date'2012-01-01', level-1) monn, 
      to_char(add_months(date'2012-01-01', level-1), 'MONTH') mon
   from dual
   connect by level<=12
)
select 
   value as language, 
   y.mon, 
   to_char(y.monn, 'MONTH', q'|nls_date_language='|' || value || q'|'|') month, 
   to_char(y.monn, 'MON', q'|nls_date_language='|' || value || q'|'|') month_s
from v$nls_valid_values n, y
where n.parameter='LANGUAGE'
order by language, y.monn

TRADITIONAL CHINESE looks easy

About these ads

7 Responses to “Learning foreign languages with Oracle SQL”

  1. […] his post titled learning foreign languages with Oracle SQL, Matthias Rogel shares the following query (I slightly modified and formatted it for […]

  2. […] his post titled learning foreign languages with Oracle SQL, Matthias Rogel shares the following query (I slightly modified and formatted it for […]

  3. […] SQL to Create a Calendar in Mutliple Languages In his post titled learning foreign languages with Oracle SQL, Matthias Rogel shares the following query (I slightly modified and formatted it for […]

  4. Neat, I like it!

    We could go for days of the week as well:

    WITH y AS
    (SELECT add_months(DATE’2012-01-01′, level -1) dayy,
    TO_CHAR(add_months(DATE’2012-01-01′, level-1), ‘DAY’) dy
    FROM dual
    CONNECT BY level<=7
    )
    SELECT value AS language,
    y.dy,
    TO_CHAR(y.dayy, 'DAY', q'|nls_date_language='|'
    || value
    || q'|'|') DAY, to_char(y.dayy, 'DAY', q'|nls_date_language='|'
    || value
    || q'|'|') DAY_s
    from v$nls_valid_values n, y
    where n.parameter='LANGUAGE'
    order by language, y.dayy

  5. […] #DBMS – Single SQL to create calendar in multiple languages […]

  6. […] on the fantastic calendar example from Sokrates/Matthias […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: