To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Database Discussions > Oracle

Oracle Discuss anything related to Oracle databases, from installation, development, maintenance, performance, security and certification.

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-19-2003, 02:29 PM
richarsk richarsk is offline
Junior Member
 
Join Date: Jun 2003
Location: Orlando, FL
Posts: 1
Oracle equivalent statement to SQL Server

Can anyone help in figuring out how you would you convert this T-SQL statement to an Oracle PL/SQL statememt:

(This gives you all anniversary dates that are between 5/15 and 6/15 of any year.)


select * FROM this_table where
( datepart(month,anniversary_date) = 5 and
(datepart(day,anniversary_date) >= 15 and datepart(day,anniversary_date) <=31))
OR
( datepart(month,anniversary_date) = 6 and
(datepart(day,anniversary_date) >= 1 and datepart(day,anniversary_date) <=15))
order by anniversary_date
Reply With Quote
  #2  
Old 06-24-2003, 09:21 AM
db_fowler db_fowler is offline
Junior Member
 
Join Date: Jun 2003
Location: New Melle MO
Posts: 2
--This gives you all anniversary dates that are between 5/15 and 6/15 of any year
-- Date_column must be an oracle DATE datatype

SELECT * FROM your_table
WHERE to_char(date_column,'mm/dd') BETWEEN '05/15' AND '06/15'

Date functionality is easy in oracle compared to t-sql.

check the sql reference manual for all related date functions

hth
Reply With Quote
Reply Post New Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 05:58 AM.


DatabaseJournal Recent Articles


 » Preparing To Upgrade Access Tables to SQL ...

 » Microsoft Windows PowerShell and SQL Serve...

 » New MySQL Enterprise with Query Analyzer B...

 » Quest Software Strengthens Committment to ...

 » Oracle Unveils New Event-Driven Middleware...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.