0
date diff for oracle 9i
Explorer
,
/t5/coldfusion-discussions/date-diff-for-oracle-9i/td-p/741369
Dec 12, 2006
Dec 12, 2006
Copy link to clipboard
Copied
Hi Guys,
I'm new in oracle... I'm using oracle in cf application now. Oracle 9i.
Now i want to display records for 6 months. How to use datediff function in oracle?
My query will like this
Select * from tblname
Where datediff(now(),fielddate) <= 6.
Any one use oracle? Please help me on this.
Thank in advance,
Regards
Shaffiq
I'm new in oracle... I'm using oracle in cf application now. Oracle 9i.
Now i want to display records for 6 months. How to use datediff function in oracle?
My query will like this
Select * from tblname
Where datediff(now(),fielddate) <= 6.
Any one use oracle? Please help me on this.
Thank in advance,
Regards
Shaffiq
TOPICS
Database access
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/date-diff-for-oracle-9i/m-p/741370#M69135
Dec 12, 2006
Dec 12, 2006
Copy link to clipboard
Copied
Oracle does not have some of the date functions present in
other db's. Two examples are datediff and dateadd.
They do have months_between. It might be appropriate in this situation.
Also, in Oracle, the current date and time is called sysdate, not now().
They do have months_between. It might be appropriate in this situation.
Also, in Oracle, the current date and time is called sysdate, not now().
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/coldfusion-discussions/date-diff-for-oracle-9i/m-p/741371#M69136
Dec 12, 2006
Dec 12, 2006
Copy link to clipboard
Copied
You might want to use "where fielddate > SYSDATE - 180,
but 180 is just an approximation in days of 6 months and won't be
exact. I use 8i, but aside from outer joins, they're very similar.
I highly recommend this page:
http://www.techonthenet.com/oracle/index.php
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
/t5/coldfusion-discussions/date-diff-for-oracle-9i/m-p/741372#M69137
Dec 12, 2006
Dec 12, 2006
Copy link to clipboard
Copied
How about using the ADD_MONTHS() function?
Something like this?
SELECT *
FROM tblname
WHERE fielddate >= ADD_MONTHS(sysdate, -6)
--or--
SELECT *
FROM tblname
WHERE ADD_MONTHS(fielddate, 6) >= SYSDATE
Phil
Something like this?
SELECT *
FROM tblname
WHERE fielddate >= ADD_MONTHS(sysdate, -6)
--or--
SELECT *
FROM tblname
WHERE ADD_MONTHS(fielddate, 6) >= SYSDATE
Phil
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
capik79
AUTHOR
Explorer
,
LATEST
/t5/coldfusion-discussions/date-diff-for-oracle-9i/m-p/741373#M69138
Dec 12, 2006
Dec 12, 2006
Copy link to clipboard
Copied
Hi Guys,
Thanks for the solution. Great help. I use ADD_MONTHS(sysdate, -6) and it works great.
Thx VM
Regards,
Shaffiq
Thanks for the solution. Great help. I use ADD_MONTHS(sysdate, -6) and it works great.
Thx VM
Regards,
Shaffiq
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

