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:)
Location: rio

Poston Tue, 06 Nov 2007 11:40 am

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


OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional

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'
from dual
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!!
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
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
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?

  • See also
    Last Post

Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests