Urgent help needed! Compare a string to Sysdate in Oracle

W

WroteForLuck

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.
 
M

Mark Schupp

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
(e-mail address removed)
http://www.ielearning.com
714.637.9480 x17
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top