We help IT Professionals succeed at work.

Query records created today in oracle

earwig75
earwig75 asked
on
933 Views
Last Modified: 2018-02-02
The Oracle table has a column called "dateIssued". I need to write a query that would select all records where dateIssued is today's date.
Can someone assist? The dates are formatted like this: "2017-04-26 00:00:00", if today's date was 4/26/17, I'd want to select all records with that date.
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Neither of those seem to work properly.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
Again, what is the data type of dateIssued?
HainKurtSr. System Analyst
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
First one was already suggested.  I added the "<" in case there were issued dates greater than today.

If it is a varchar2 and in the format provided, the second one will fail because it doesn't account for the time portion of the string.
Sr. System Analyst
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
Why use LIKE or string concatenation?  Just convert sysdate to correct string format as I posted.
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
Why use LIKE or string concatenation?

maybe that column has some other values than 00:00:00 and maybe there is an index on that column...

so, instead of converting all to date and compare with sysdate, it will be better to use "LIKE" operation
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
so,  before posting more, lets wait for table structure :)

please post the table structure for your table + a few sample data...
HainKurtSr. System Analyst
CERTIFIED EXPERT

Commented:
no more feedback and I assume it is data issue and all suggested solutions work after a cleanup on data...

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.