By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

Urgent help needed! Compare a string to Sysdate in Oracle

P: n/a
I am trying to write a simple SQL statement which will take a string
(startdate) in the format DDMMYYYY and compare it to a date stored in
an Oracle database. My SQL is as follows:

<%

"select * from tblhistory where datechanged = '" & startdate & "'"

%>

The field datechanged in the Oracle database is set up using the
Sysdate variable, on a previous occasion.

Any ideas how I can get my startdate variable into the correct format
so that I can compare it with the 'datechanged' field?

Thanks in advance.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
look up the to_date function in oracle help.

Here is what we use (replace %%DATE%% with the date string in yyyy-mm-dd
hh24:mi:ss format):

TO_DATE('%%DATE%%','YYYY-MM-DD HH24:MI:SS')

--
Mark Schupp
--
Head of Development
Integrity eLearning
Online Learning Solutions Provider
ms*****@ielearning.com
http://www.ielearning.com
714.637.9480 x17
"WroteForLuck" <k_*******@hotmail.com> wrote in message
news:1b**************************@posting.google.c om...
I am trying to write a simple SQL statement which will take a string
(startdate) in the format DDMMYYYY and compare it to a date stored in
an Oracle database. My SQL is as follows:

<%

"select * from tblhistory where datechanged = '" & startdate & "'"

%>

The field datechanged in the Oracle database is set up using the
Sysdate variable, on a previous occasion.

Any ideas how I can get my startdate variable into the correct format
so that I can compare it with the 'datechanged' field?

Thanks in advance.

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.