Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 9th, 2004, 06:38 AM
gintom gintom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Essex, UK
Posts: 164 gintom User rank is Private First Class (20 - 50 Reputation Level)gintom User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 17 h 16 m 46 sec
Reputation Power: 5
dateadd function in Oracle

I am having some trouble with the dateadd function.

I am using Oracle 8 and Sql Server databases and in my SQL statements for SQL Server I have the dateadd function to add hours and days to the date and that works perfect.

But I also need the same function to be used in Oracle. I know that dateadd is not a function in Oracle 8 so how do I get around this. I have tried the following that I have read from other sources but this doent seem to work.

Code:

FieldName1 <= to_date('20040809 19:00:00','YYYYMMDD HH24:MI:SS') 'FieldName2 /1440' 


Any help would be greatfully appreciated

Reply With Quote
  #2  
Old August 9th, 2004, 10:49 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
See if this link is useful
http://philip.greenspun.com/sql/dates.html
__________________
El éxito consiste en una serie de pequeñas victorias día a día

MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html

Reply With Quote
  #3  
Old August 9th, 2004, 11:54 AM
gintom gintom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Essex, UK
Posts: 164 gintom User rank is Private First Class (20 - 50 Reputation Level)gintom User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 17 h 16 m 46 sec
Reputation Power: 5
thanks victor that has cleared somethings up about the oracle dates but still hasnt help me solve my problem

this is actually the problem code that I am having it doesnt seem to add the 15 minutes to the time.

Code:

SELECT Field1 FROM Table1 WHERE Field2 >= to_date('20040809 18:00:00','YYYYMMDD HH24:MI:SS') + '15/1440'

Reply With Quote
  #4  
Old August 9th, 2004, 12:12 PM
KK2796 KK2796 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 11 KK2796 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by gintom
thanks victor that has cleared somethings up about the oracle dates but still hasnt help me solve my problem

this is actually the problem code that I am having it doesnt seem to add the 15 minutes to the time.

Code:

SELECT Field1 FROM Table1 WHERE Field2 >= to_date('20040809 18:00:00','YYYYMMDD HH24:MI:SS') + '15/1440'


This worked when I took the ticks off of the '15/1440', which Oracle will not recognize as a valid number.

Code:
SELECT 
    TO_DATE('20040809 18:00:00','YYYYMMDD HH24:MI:SS') ORIGINAL, 
    TO_DATE('20040809 18:00:00','YYYYMMDD HH24:MI:SS') + 15/1440 MODIFIED 
FROM DUAL


This would change your code to
Code:
SELECT Field1 FROM Table1 
WHERE Field2 >= TO_DATE('20040809 18:00:00','YYYYMMDD HH24:MI:SS') + 15/1440

Reply With Quote
  #5  
Old August 10th, 2004, 04:10 AM
gintom gintom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Essex, UK
Posts: 164 gintom User rank is Private First Class (20 - 50 Reputation Level)gintom User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 17 h 16 m 46 sec
Reputation Power: 5
cheers mate that works perfect!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > dateadd function in Oracle


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway