Results 1 to 2 of 2

Thread: Oracle equivalent statement to SQL Server

  1. #1
    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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •