Nov 192012
 

Copy/paste into your Oracle client of choice and start learning!

create procedure into_many_languages (
  convert_this_error integer)
as
 curr_lang varchar2(100);
begin
  select value 
  into   curr_lang 
  from   nls_session_parameters 
  where  parameter = 'NLS_LANGUAGE'; 

  for langs in (
    select * from v$nls_valid_values 
    where  parameter = 'LANGUAGE' 
    order by value) loop

    execute immediate 
      'alter session set nls_language=''' || 
       langs.value || '''';
    dbms_output.put_line(
      initcap(langs.value) || ' ' || 
      sqlerrm(convert_this_error));

  end loop;

  --tidy up after yourself ;)
  execute immediate 
    'alter session set nls_language=''' || 
     curr_lang || ''''; 
end; 
/ 
show errors 

set serveroutput on
exec into_many_languages(-600); 
exec into_many_languages(-1403); 

drop procedure into_many_languages;

Expanding on the fantastic calendar example from Sokrates/Matthias Rogel

  One Response to “Learning foreign languages with Oracle PL/SQL”

  1. Hi Chris,

    very nice, I like it !

    Cheers,
    Matthias

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)