Question: I am using MSSQL using the T-SQL
DATEADD function to add a duration to an existing date.
this example, I am adding a duration expressed in seconds to a
existing DATE datatype:
current_end_time := DATEADD(second, current_duration/10,
What is the equivalent of DATEADD for adding Oracle dates?
Answer: Above you are adding the seconds
in your current_duration to an existing date. Oracle is far
more powerful than MSSQL, and there are several ways to replicate
- Write your own
DATEADD function. In Oracle PL/SQL, you
autonomous functions that become instantly available as any other
built-in function. This makes Oracle infinitely extensible
and any TSQL date addition function can be replicated in PL/SQL.
- Use the add_months function in Oracle, and use
simple math to convert the month
value to seconds.
- You can also use the Oracle interval function
See here for more
date arithmetic examples
Get the Complete
Oracle SQL Tuning Information
The landmark book
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
for 30% off directly from the publisher.