|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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'
|
|
#4
|
|||
|
|||
|
Quote:
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
|
|
#5
|
|||
|
|||
|
cheers mate that works perfect!
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > dateadd function in Oracle |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|