Home » RDBMS Server » Server Administration » Compare Day and Month with Sysdate
Compare Day and Month with Sysdate [message #57503] Thu, 19 June 2003 08:50 Go to next message
Craig
Messages: 28
Registered: October 2001
Junior Member
Guys

I need to isolate a customers birthday and so need to compare just the day and month with the sysdate, as the customer birthyears are all different. How do I do this?

Cheers

Craig
Re: Compare Day and Month with Sysdate [message #57505 is a reply to message #57503] Thu, 19 June 2003 09:39 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
USE TO_CHAR TO EXTRACT The month and year
dbadmin@mutation_mutation > select  sysdate,
  2          to_char(sysdate,'dd') day ,
  3          to_char(sysdate,'yyyy') year,
  4          to_char(sysdate,'dd')+2 "day+2",
  5          to_char(sysdate,'yyyy')+2 "year+2",
  6          to_char(sysdate,'mm') month,
  7          to_char(sysdate,'mm')+2 "month+2"
  8  from dual
  9  /

SYSDATE  DA YEAR      day+2     year+2 MO    month+2
-------- -- ---- ---------- ---------- -- ----------
06/19/03 19 2003         21       2005 06          8

"afiedt.buf" 2 lines, 61 characters 

  1* select * from emp where to_char(hiredate,'yyyy') >= '1982'
dbadmin@mutation_mutation > 
dbadmin@mutation_mutation > /

     EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------
      7788 SCOTT      ANALYST         7566 07/13/87       3000                    20
      7876 ADAMS      CLERK           7788 07/13/87       1100                    20
      7934 MILLER     CLERK           7782 01/23/82       1300                    10

Previous Topic: TUNING APPROACH
Next Topic: One Specific Forms invoked through Oracle 9iAS gets Hang
Goto Forum:
  


Current Time: Fri Sep 20 10:33:32 CDT 2024