Connecting Tech Pros Worldwide Help | Site Map

Urgent help needed! Compare a string to Sysdate in Oracle

WroteForLuck
Guest
 
Posts: n/a
#1: Jul 19 '05
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.
Mark Schupp
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Urgent help needed! Compare a string to Sysdate in Oracle


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
mschupp@ielearning.com
http://www.ielearning.com
714.637.9480 x17


"WroteForLuck" <k_stander@hotmail.com> wrote in message
news:1bb8fc86.0307170055.2928701c@posting.google.c om...[color=blue]
> 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.[/color]


Closed Thread