Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ora-00936 missing expression

Status
Not open for further replies.

gmoney7

Programmer
Jun 13, 2001
2
US
I'm getting an error when using this expression on my select statement TO_DATE([NOW - 30], 'MM/DD/YYYY HH:MI:SS AM')
 
That is because oracle doesn't have a NOW function as far as I know. Try using:

SELECT TO_DATE(SYSDATE - 30, 'MM/DD/YYYY HH:MI:SS AM')
FROM DUAL;

Looks like you copied that from MS Access... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Terry's right, but it's even simpler than that. Sysdate-30 is already a date, so there's no need to use the to_date function. The resulting query is

select sysdate-30 from dual;

Probably you intended to use the to_char function in order to format the output. That would make the query

SELECT TO_CHAR(sysdate-30, 'MM/DD/YYYY HH:MI:SS AM')
FROM DUAL;

 
Whoops... Thanks Karluk. I saw the TO_ and knew they were converting it to CHAR for the formatting. Never even looked at DATE part of it. Sometimes, cut, paste, and edit is not the best way to do it... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top