Solved

Oracle SQL

Posted on 2013-02-04
3
263 Views
Last Modified: 2013-02-04
I need to pull all of the birthdate records in a table which have a month of January and a day of 1 no matter what year.    When I use the where clause as AND (voters.date_of_birth like To_date ('01/01','MM/DD')) it only pulls records for 1913.  Can anyone help with this?
0
Comment
Question by:restockett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 38852199
If you have an index on date_of_birth this will ignore it but:
where to_char(voters.date_of_birth,'MMDD') = '0101';
0
 
LVL 35

Expert Comment

by:johnsone
ID: 38852381
Since you are looking for 1/1, you can use trunc

where date_of_birth = trunc(date_of_birth, 'yyyy')

Of course, that only works with 1/1.
0
 
LVL 32

Expert Comment

by:awking00
ID: 38852643
where mod(months_between(trunc(sysdate,'yyyy'),date_of_birth),12) = 0
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MULTIPLE DATE QUERY 15 103
use lov values 2 72
Oracle Errors 11 52
Cannot connect to Oracle database, python not recognizing cx_Oracle 2 32
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question