lara123
lara123

Reputation: 41

How to query by ising data and time with using sql

I want to fetch record based on my where condition.

This is my query.

select * from student where createdDate = '04/18/2013 03:24:49';

But I am not getting any record...

Upvotes: 0

Views: 54

Answers (2)

Emil Moise
Emil Moise

Reputation: 393

In case your createdDate column is of type date, you should use to_date function:

select * from student where createdDate = to_date('mm/dd/yyyy hh24:mi:ss', '04/18/2013 03:24:49');

Upvotes: 2

Thorsten Kettner
Thorsten Kettner

Reputation: 95062

This is no valid datetime literal you are using. Use this instead:

select * from student where createdDate = timestamp'2013-04-18 03:24:49';

Upvotes: 2

Related Questions