Doubt with TO CHAR

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

Poston Thu, 10 Jul 2008 8:21 am

Hey guys IM aqui again, you guys need to understand how it works the whole TO CHAR a select example mad and think the solution would be this TO CHAR.

I have to bring everyone's birthday today for example because we are putting on the company website a part to birthday boy of the day then in the Bank the date of birth is recorded thus: 4/21/1947 Supunhetamos that today was 4/21/1947 ok as you would a select to rotate every day at PHP server. Envisioned to char as take the strings 0 to 4 to compare with the server.
carlos12
Location: rio

Poston Thu, 10 Jul 2008 8:45 am

Brother, assuming the date of birth in your base is UP-TO-DATE, see this example:
Code: Select all
DECLARE
  vdt_nasc DATE := TO_DATE('10/07/1977','dd/mm/rrrr'); -- quem nasceu em 10/07
  vhoje    DATE := TRUNC(SYSDATE);
BEGIN

  IF TO_CHAR(vdt_nasc,'dd/mm') = TO_CHAR(vhoje,'dd/mm')
  THEN
     dbms_output.put_line('Tem gente fazendo aniversário hoje! ');
  END IF;

END;
anything, send it to us.
Trevisolli
Location: Araraquara - SP

Abraço,

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

Poston Thu, 10 Jul 2008 8:47 am

To complement: the EXTRACT command, but it picks up only the YEAR, month or DAY individually.

Here's the link: viewtopic.php?t=2344:-
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

Poston Thu, 10 Jul 2008 10:25 am

Guys valeu by force I ended up riding like this:
Code: Select all
select a.NOME, TO_CHAR(a.NASCIMENTO, 'DD') AS DIA, TO_CHAR(a.NASCIMENTO, 'MM') AS mês
from producao.login_site a where TO_CHAR(a.NASCIMENTO, 'DD') = TO_CHAR(sysdate, 'DD') and
TO_CHAR(a.NASCIMENTO, 'MM') = TO_CHAR(sysdate, 'MM')
and worked for a while, but really how long cheezburger network Ai valeu Brother thanks for the tip. and thanks to the também dr_gori and Thomas f. g.
carlos12
Location: rio

Poston Thu, 10 Jul 2008 10:42 am

Say old man, I'm glad it worked and how long ... I'm kind of curled up in projects.

But, as is working, we're helping and learning.

Cheers to you old man.
Trevisolli
Location: Araraquara - SP

Abraço,

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


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 4 guests