Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Date

Re: Date

From: Jim Kennedy <kennedy-down_with_spammers_at_no_spam.comcast.net>
Date: Sat, 13 Sep 2003 00:56:48 GMT
Message-ID: <kXt8b.425599$YN5.287628@sccrnsc01>


"Ralf Schnickmann" <ralf_schnickmann_at_gmx.de> wrote in message news:bjsuo7$n3e7m$1_at_uni-berlin.de...
> Hi!
>
> The Query
> SELECT * FROM T_Test WHERE Start > '1.1.2002'
> is running with the correct results.
>
> Using a date with time like
> SELECT * FROM T_Test WHERE Start > '1.1.2002 1:00:01'
> doesnt work.
>
> My problem is that i have to avoid any function like to_date etc.
>
> Thanks,
> Ralf
>
>

Why not use to_date? What you are attempting to do is compare a date with a string. To do that you are assuming a particular format for the string. So if someone changes that format your program breaks or works erratically(even worse). If you are using a program that is using an API to call the database then it should have native support for a date datatype and hence you would not need to_date. I would use to_date, it allows me to have programs that run reliably, and it clearly specifies what is the month and what is the day. In your example, I cannot tell.(it depends if you are using a European format or an American format, which is a bad thing to depend on.)

What format or label something is in is very important. The Mars Lander crashed because the two entities used two different units of measure (NASA uses metric and Lockheed Martin uses English) and they exchanged data as raw numbers with out a label of the units. Units and formats are important and implicit conversions raise the probability of an error. Jim Received on Fri Sep 12 2003 - 19:56:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US