|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
|
#2
|
|||
|
|||
|
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; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Calculating date questions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|