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: Just want day but no time information

Re: Just want day but no time information

From: Valery V. Tsekhmister <valery_tsekhmister_at_hotmail.com>
Date: Fri, 13 Feb 2004 20:22:52 +0300
Message-ID: <c0j15i$7tg$1@slim.sovintel.ru>


Hi Dave !

This task can be accomplished using the approach below.

create table q ( q varchar2(32) unique ); -- Here you create table with column q to store text representation of data (by default it contains day

                                                                        info
only without time)
insert into q values (sysdate);                         -- Here you insert
some date value into your table (implicit conversion is being done automatically)
insert into q values (sysdate+2/86400); -- Here you try to create next row with value differing by 2 seconds. Operation fails because of

unique constraint

drop table q;                                                  -- Afterward,
you drop your table :):)

Regards !
Valery.

"D. Alvarado" <laredotornado_at_zipmail.com> wrote in message news:9fe1f2ad.0402130809.2e62aad8_at_posting.google.com...
> Hello, I'm running Oracle 8.1.7 for Solaris. I want to impose a
> constraint on one of my tables that no two dates can be stored that
> are from the same day. That is, if a row contains the date 2-13-04
> 7:56 AM, I don't want anyone to be able to create a row with the date
> 2-13-04 11:26 AM. Ideally, it would be great if there's a column type
> that just has day (but no time) information, but I can't seem to find
> such a column type. Any advice on how I can make this constraint
> work?
>
> Thanks - Dave
Received on Fri Feb 13 2004 - 11:22:52 CST

Original text of this message

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