Re: Managing DATE in FORMS

From: Alex Heney <heneya_at_entcf3.agw.co.bt.uk>
Date: 1997/03/03
Message-ID: <331AB3A4.4D9_at_entcf3.agw.co.bt.uk>#1/1


TNasset wrote:
>
> >I'm in trouble for the following problem:
> >
> >In a Form (dev/2000 1.3 x win95) I have a DATE field corrisponding to
> >a database DATE field ... when I try to make a query on this field (e.g.
> >01/02/97), no record is returned (NLS_DATE_FORMAT is set correctly, both
> >on server and client).
> > (Similarly in PL/SQL I get nothing if I do: SELECT * from EMP where
> >ins_date='01/02/97';)

Remember that the DATE field on the databacse includes the Time. If you use TRUNC(ins_date) = '01/02/97' (or maybe '01-FEB-97'), you should get the row(s) returned. In FORMS, using the Date type for an item uses the truncated form of the field. If you want the whole thing, use Datetime. If you only want the date part stored, then you should either always store it from FORMS, using Date fields, or always TRUNC the field when it is stored (This can be done using a databse trigger). If you do this, then tere would be no need to use TUNC when querying.

-- 
The above posting represents the personal opinions of the author and
is not to be taken as official (or unofficial) policy or opinions of 
his employer.

Alex Heney, Living in the Global Village.
Received on Mon Mar 03 1997 - 00:00:00 CET

Original text of this message