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: database date fields

Re: database date fields

From: Philippe Arnaud <parnau_at_ctp.com>
Date: 24 Jul 1998 05:56:04 GMT
Message-ID: <01bdb6c7$4f958cb0$2a822c95@pdcpm>


Try TRUNC(date_field)

Hari Thanigaraj <hari_at_cardsfellow.wustl.edu> wrote in article <35B80859.EDA_at_cardsfellow.wustl.edu>...
> Hi!
>
> I am having problems querying date fields in the database. I am trying
> to write a query in these lines.
>
> select * from my_table where
> date_field >= (select nvl(:from_date,min(date_field)) from
> my_table)
> and date_field <= (select nvl(:to_date,max(date_field)) from
> my_table)
>
> (subqueries used to handle optional input parameters)
>
> date_field - database field (datetime)
> date_parameter - input field(date)
>
> Suppose the database Record has value 05-28-1998 01:01:01
> and the input field has value 05-28-1998 there still is no match
> because of the time stamp.
>
> The solution might convert the dates using to_char with 'YYYYMMDD" mask
> for
> both the database field and the input date field. However the
> statement gets more complex. And also it would'n be very elegant. Is
> there any other solution?. A funtion to extract the datepart alone
> from the database field perhaps ?
>
> Any suggestion would be greatly appreciated.
>
Received on Fri Jul 24 1998 - 00:56:04 CDT

Original text of this message

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