Link to home
Start Free TrialLog in
Avatar of dkilby
dkilbyFlag for Canada

asked on

oracle sql developer + get hour from datetime field

I need to compare an hour field

this works in MS SQL and trying to get similar in Oracle SQL Developer

hh is a number ie: 8

sum(case when hh=datepart(hour, dateadd(hh,1,getdate())) then 1 else 0 end) > 0

the current time - 1 hour and then just getting the hour.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Since this is the second in what I'm guessing will be a series, I wanted o point this out:
You may be able to do a pretty direct port from SQL Server to Oracle but I will caution you that it may not perform the same.  The two databases do things pretty differently.  To get Oracle to perform, you need to understand how and why it does what it does.