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: How to prevent duplicate values in column and allow only a certain range ?

Re: How to prevent duplicate values in column and allow only a certain range ?

From: Miles Thomas <thomasm_at_>
Date: 1997/05/28
Message-ID: <01bc6b65$5a6700a0$4621ea9e@UKP01436.logica.co.uk>#1/1

Jens U. Veigel <jens_at_deutschware.com> wrote in article <338b083c.801392_at_news.aud.alcatel.com>...
> Hi Pros !
>
> Got a forms4.5 App, that allows entry of numbers into a table.
> One column of this table has let's say row number values that are
> allowed 1-10.
>
> How do I force my users, or notify them that when they try to
> enter a value (a number) in this particular column, that a row with
> this number in that particular column already exist, and therefore
> are not allowed to use this number). And how do I define a possible
> range of numbers that is allowed for entry ?
>
> So if the column has already rows numbers with 1,2,3,4,5,6,7,9,10,,,
> the only value allowed should be 8, if anything else is input I need
> to message the user. Have no trouble on the message part, but how do I
> check for duplicate entires, at comit time.
>
> I like the "format mask" "MM-DD-YY" type validation, where I tell the
> user what the format is , so he can retype it . Is this possible for
> checking on duplicates, and if they are excist to flag the user ?
>
>
> Thanks for all your help and suggestions.
>
>
> Jens
> jens_at_deutschware.com
>
>
>

If the field is part of a primary key, then include all the PK fields in the block (hiding some if necessary), and set the PK property. If memory serves, there is a block-level property about enforcing PK & preventing duplicates.

In addition, you might consider puting a PK or unique key constraint in the database, and catch the error the database returns.

Also, why not create a when_create_record (name?) trigger that calculates the next available value, or possibly a key trigger on the field, so that the user does not have to think about this.

-- 
Miles Thomas
Logica UK Ltd
thomasm "at" logica "dot" com
The above are personal opinions, and are
not necessarily the opinions of my employer.
Received on Wed May 28 1997 - 00:00:00 CDT

Original text of this message

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