SQL Statement

I have an Oracle 8.something I need to query based on date year in TOAD
How would I change the sql statement below to Oracle SQL to get the data from March of 2007?

select * from dbo.table1
where year(ord_dt)='2007' and Month(ord_dt) = 3
Larry Bristersr. DeveloperAsked:
Who is Participating?
 
gatorvipCommented:
select * from dbo.table1
where  extract(YEAR FROM ord_dt) = 2007
    and extract(MONTH FROM ord_dt) = 3
0
 
hongjunCommented:
try this

select * from dbo.table1
where ord_dt >='2007-03-01'
0
 
gatorvipCommented:
select * from dbo.table1
where ord_dt >= to_date('03-01-2007', 'MM-DD-YYYY')
    and ord_dt <  to_date('04-01-2007', 'MM-DD-YYYY')
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Larry Bristersr. DeveloperAuthor Commented:
hongjun:
  I need to be a little clearer.  
This is a prerequisite to building a case statement so that I can build a query where each column is a prticular month's sales etc.

I really need that month / year ability without using a lot of >+ and <+ whis is what would have to be done.
0
 
hongjunCommented:
try this

select * from dbo.table1
where (year(ord_dt) = 2007 and month(ord_dt) >= 3) or (year(ord_dt) > 2007)
0
 
slightwv (䄆 Netminder) Commented:
select ...
from table
where to_char(ord_dt,'RRRR')='2007' and to_char(ord_dt,'fmMM') = 3;
0
 
Larry Bristersr. DeveloperAuthor Commented:
gatorvip:

perfect.  Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.