Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Restricting the range of values in a field

RE: Restricting the range of values in a field

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Thu, 30 Jan 2003 08:34:29 -0800
Message-ID: <F001.0053EDA5.20030130083429@fatcity.com>


create or replace trigger my_restrictions on my_table after insert or update as
declare

   unacceptable_values exception;
begin
  begin
   if :new.my_restricted_column not in ('Blah1','blah2','Blah3') then

this should pretty much handle it for you ... don't take this code at its face value, there could be syntactic errors .. I just wrote on the fly.

Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!

-----Original Message-----
Sent: Thursday, January 30, 2003 11:01 AM To: Multiple recipients of list ORACLE-L

Is there any way you can specify that the only permissible values (is it called a domain?) that can be entered in varchar2 field in an Oracle table to, for example, A, B and C?

We can restrict what values users can enter at the application level, but it would be nice to be able to also restrict what can be entered at the database level, in case other means of entering data are ever used or if the application layer fails, for whatever reason, to trap an unwanted value.

Thanks

--

Aidan Whitehall <aidanwhitehall_at_fairbanks.co.uk> Macromedia ColdFusion Developer
Fairbanks Environmental Ltd +44 (0)1695 51775



This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Aidan Whitehall
  INET: AidanWhitehall_at_Fairbanks.co.uk
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Thu Jan 30 2003 - 10:34:29 CST

Original text of this message

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