Month by extensive

Este forum é dedicado a códigos errados que se encontram por aí, ou seja, coisas que não se deve fazer de jeito nenhum! Não coloque neste forum dúvidas! (apenas situações bizarras do nosso dia a dia :-)
Post Reply
alexandrecrocha
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Mon, 31 Dec 2007 8:38 am
Location: Porto Alegre - Rs

I found the code below in a procedure ....
-------------------- ---------------------------------------

Select all

 
declare 
  V_mês Number := to_char(Sysdate,'MM'); 
  V_mês_Ext Varchar2(20); 
Begin 
 
  If    v_mês = 01 Then 
    V_mês_Ext := 'Janeiro'; 
  Elsif v_mês = 02 Then 
    V_mês_Ext := 'Fevereiro'; 
  Elsif v_mês = 03 Then 
    V_mês_Ext := 'Março'; 
  Elsif v_mês = 04 Then 
    V_mês_Ext := 'Abril'; 
  Elsif v_mês = 05 Then 
    V_mês_Ext := 'Maio'; 
  Elsif v_mês = 06 Then 
    V_mês_Ext := 'Junho'; 
  Elsif v_mês = 07 Then 
    V_mês_Ext := 'Julho'; 
  Elsif v_mês = 08 Then 
    V_mês_Ext := 'Agosto'; 
  Elsif v_mês = 09 Then 
    V_mês_Ext := 'Setembro'; 
  Elsif v_mês = 10 Then 
    V_mês_Ext := 'Outubro'; 
  Elsif v_mês = 11 Then 
    V_mês_Ext := 'Novembro'; 
  Elsif v_mês = 12 Then 
    V_mês_Ext := 'Dezembro'; 
  End If; 
 
  Dbms_Output.put_line('mês EXTENSO: '||V_mês_Ext); 
  
End; 
- -------------------------------------------------- ------------
This one below does the same thing ...

Select all

 
declare 
  V_mês_Ext Varchar2(20); 
Begin 
  v_mês_ext := (to_char(Sysdate,'Month','nls_date_language =''brazilian portuguese''')); 
  Dbms_Output.put_line('mês EXTENSO: '||V_mês_Ext); 
End; 
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

I have already seen cases that it is useful to use a table to save the months: in cases of multi-language, so it is better to register in the table. (not only months, but other things tb): -The

But this case above, it really is best to use NLS: -O
gokden
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 264
Joined: Sun, 19 Aug 2007 8:18 pm
Location: Ribeirão Preto - SP
Lucas de Souza

OCA Developer
Analista de sistemas

hehehehehehehe ....
I was tinkering with calendar now, almost qui I did a procedure just like from above = D
luck that a guy I explain this change of exchange the language in to_char = D
NaPraia
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 88
Joined: Fri, 22 Feb 2008 8:24 am
Location: Floripa - SC

Select all

to_char(Sysdate,'Month','nls_date_language =''brazilian portuguese''')
Manage this command, I did not know
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests