Connecting Tech Pros Worldwide Help | Site Map

Urgent help needed! Compare a string to Sysdate in Oracle

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 19th, 2005, 05:51 AM
WroteForLuck
Guest
 
Posts: n/a
Default Urgent help needed! Compare a string to Sysdate in Oracle

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.

  #2  
Old July 19th, 2005, 05:51 AM
Mark Schupp
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.