Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Posts
    140

    Red face Unanswered: Convert function from SQL Server to oracle

    Hello experts,

    Could someone help me convert this SQL Server function to ORACLE 9.2. Thanks

    Code:
    Function (numbervar v1)
    datetimevar GMTdate := datetime(1970,01,01)+(v1/(60*60*24));
    
    //this equation tells the system when daylight savings time starts: 
    datevar DaylightStarts :=                                                   
    if DayOfWeek ( Date (Year (Today),3 ,8 ) ) = 1 then Date (Year (Today),3 ,8)  else 
    if DayOfWeek ( Date (Year (Today),3 ,9 ) ) = 1 then Date (Year (Today),3 ,9)  else 
    if DayOfWeek ( Date (Year (Today),3 ,10) ) = 1 then Date (Year (Today),3 ,10) else
    if DayOfWeek ( Date (Year (Today),3 ,11) ) = 1 then Date (Year (Today),3 ,11) else
    if DayOfWeek ( Date (Year (Today),3 ,12) ) = 1 then Date (Year (Today),3 ,12) else 
    if DayOfWeek ( Date (Year (Today),3 ,13) ) = 1 then Date (Year (Today),3 ,13) else
    Date (Year (Today),3 ,14 );    
    
    
    //this is when it ends: 
    datevar DaylightEnds :=                                                            
    if DayOfWeek ( Date (Year (Today),11 ,1 ) ) = 1 then Date (Year (Today),11,1 ) else 
    if DayOfWeek ( Date (Year (Today),11 ,2 ) ) = 1 then Date (Year (Today),11,2 ) else 
    if DayOfWeek ( Date (Year (Today),11 ,3 ) ) = 1 then Date (Year (Today),11,3 ) else 
    if DayOfWeek ( Date (Year (Today),11 ,4 ) ) = 1 then Date (Year (Today),11,4 ) else 
    if DayOfWeek ( Date (Year (Today),11 ,5 ) ) = 1 then Date (Year (Today),11,5 ) else 
    if DayOfWeek ( Date (Year (Today),11 ,6 ) ) = 1 then Date (Year (Today),11,6 ) else 
    Date (Year (Today),11 ,7 );
    
    numbervar timeadj :=
    if (GMTdate < DaylightStarts) or (DaylightEnds <= GMTdate) then 5 
    else 4;
    //put it all together and we have date
    date(GMTdate-(timeadj/24))

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    That's no SQL Server syntax that I have ever seen.

Posting Permissions

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