SQL for data

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Tue, 06 Nov 2007 11:29 am

Hello guys I have a problem I would do a select to verify the date of birth of a face and return the following: on the date of birth by decreasing the current year, return his age today and using the DECODE I can put one sentence if the age is between 35 to 40:)
carlos12
Location: rio

Poston Tue, 06 Nov 2007 11:40 am

Brother, Do a test with this example:
Code: Select all
SELECT CASE
        WHEN ((SYSDATE - sua_data) / 365) BETWEEN 35 AND 40
        THEN
                           'Está no período desejado'
        ELSE
                           'Não está'
       END
  FROM sua_tabela
anything, send there.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Poston Tue, 06 Nov 2007 11:44 am

order an example using my date of birth see if it fits for you
Code: Select all
select case
         when trunc((months_between(sysdate, to_date('18/03/1985','dd/mm/yyyy')))/12) < 10 then
           'menor que 10 anos'
         when trunc((months_between(sysdate, to_date('18/03/1985','dd/mm/yyyy')))/12) < 20 then 
         'entre 10 e 20'
         when trunc((months_between(sysdate, to_date('18/03/1985','dd/mm/yyyy')))/12) < 30 then 
         'entre 20 e 30'
       end   
from dual
rodfbar
Location: Batatais - SP

Poston Tue, 06 Nov 2007 1:59 pm

People once again much appreciated goodwill of all. Once again you guys responded and helped me a lot, here in the company where I work sometimes appear certain difficulties, but I'm glad we have people towards helping. Once again thank you very much!!
carlos12
Location: rio

Poston Tue, 06 Nov 2007 2:07 pm

in the world of programming, thank god there are a few ignorant ... at least I know very few ... until now mtas people helped me and ta in hr I do my part ... Although I don't know a lot there is a saying \"nobody is so big that can't learn and not as small q não can teach\" needing abrçs orders
rodfbar
Location: Batatais - SP

Poston Tue, 06 Nov 2007 4:12 pm

This forum exists only because of this! (there's a lot of people with good will to lend a hand from time to time) ...:-D
dr_gori
Location: Portland, OR USA

Thomas F. G

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


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 4 guests