Re: Using a sequence to force unique DATE field
Date: 1995/06/28
Message-ID: <3sq6ud$lef_at_ionews.ionet.net>#1/1
In article <3sprt1$nm1_at_newstand.syr.edu>, eastephe_at_mailbox.syr.edu
says...
>
>We currently have a set of two tables that are linked together
>by only a DATE field. Usually, the field can be unique but since
>O doesn't support milliseconds with the DATE, we sometimes
>run into PK violations. (And yes, we should have used a SEQUENCE with a
>NUMBER type column, but that's another story.)
>
>What I'd like to do is stuff the following value into the DATE:
>
>to_date(forrest_gump.nextval,'sssss')
>
>where forrest_gump is a sequence ranging from zero to
>86399. The expression above returns the date as being 6/1/95
>and then an appropriate number of seconds based on the
>sequence. Is that normal? Anyone know any better tricks to
>hack around this problem?
>
Yes... I don't know why you didn't use a sequence and number column..
You might try this to get your date:
select to_date( to_char(trunc(sysdate))||' '||
to_char(forrest_gump.nextval, '99999'), 'DD-MON-YY SSSSS' )
into :whatever_the_date_field_is_called from dual.
Hope this helps some...
Lee Mayhew Received on Wed Jun 28 1995 - 00:00:00 CEST