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: Oracle to_date() function and ANSI SQL 99

Re: Oracle to_date() function and ANSI SQL 99

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Thu, 04 Apr 2002 02:34:00 GMT
Message-ID: <sYOq8.188509$uA5.152259@rwcrnsc51.ops.asp.att.net>


Just because another database has a function called to_date does not mean it operates the same nor does it mean that it has anything to do with an ansi standard. (not familiar with the to_date function in PostgrSQL; it might take the same arguments and same format strings and it might not. I don't know.) My point is don't assume defaults, make sure you specify what it is that you want. (eg same could be said of people who are looking for the "default" order in a select statement without an order by - what should the order be? It should be anything the database chooses and random because the request was not explicit enough, so the user didn't care what order - or they would have specified one.)

If you are writing some sort of driver that is supposed to be "database" independent then you have to put the exceptions in a low level of the driver and just accept the fact that different databases are different. There are many levels of compliance to ansi standards and I think people would be hard pressed to find any database that meets all levels and all versions of ansi sql compliance and if you do then you have tied yourself to one database. (which is what you were probably trying to not do.)

Jim

"Neil Zanella" <nzanella_at_cs.mun.ca> wrote in message news:b68d2f19.0204031702.408c5734_at_posting.google.com...
> "Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message:
>
> > A better way is to use to_date and not rely on the client side
> > nls_date_format setting.
> > eg
> > insert into t values(to_date('2001-12-13','yyyy-mm-dd'));
> >
> > or on the client specify the nls_date_format you want instead of the
default
> > (which you can change on the server in the init.ora file; you have
noticed
> > that the default for the default is as you say, but it is configurable).
> >
> > Relying on a specific string format for a date without specify the
format is
> > asking for trouble. Why? A client machine could change the
nls_date_format
> > setting on you and that would mess up your data.
>
> Interestingly enough the to_date() function you mention is available not
only
> on Oracle but also in PostgreSQL. However MySQL does not implement it. Is
the
> to_date() function by any means part of the more recent ANSI SQL 99
standards?
> That is, can I expect to find it on other ANSI SQL conformant database
such
> as Informix, DB2, etc... or is it an Oracle specific function which just
> happens to be supported by PostgreSQL by chance?
>
> Thanks,
>
> Neil
Received on Wed Apr 03 2002 - 20:34:00 CST

Original text of this message

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