?
Solved

Oracle SQL

Posted on 2013-02-04
3
Medium Priority
?
265 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
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…
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

765 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