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:
  #1  
Old November 16th, 2004, 02:37 PM
matteorr matteorr is offline
PEBKAC!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: central Ok
Posts: 163 matteorr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 5 m 37 sec
Reputation Power: 5
Calculating date questions

I have 2 separate queries I need to make.

The first one I need is to check if the current time is after a date entered into a table.

The other inserts the current date + 3weeks (or 21 days) into that table.

I'm thinking it should be along the lines of...
Code:
select * from table where dateField < currentDate

and...
Code:
update table set dateField = (currentDate+21) where id = XX


But I don't know the exact syntax, and I'm not getting good results on google. Can someone point me in the right direction. Thanks in advance!

Reply With Quote
  #2  
Old November 16th, 2004, 05:02 PM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,308 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 5 h 20 m 49 sec
Reputation Power: 48
Oracle date datatypes actually store the date and time. So when you compare them on a 'date' basis,, you may want to use the TRUNC( mydate_column) function which turns Oracle Date/Time into just Date, like a regular date.

SYSDATE is today's Date/Time

Code:
SELECT * from mytable where datefield < SYSDATE;

UPDATE mytable set datefield=SYSDATE + 21 where ID =XX;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Calculating date questions


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT