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: Constraint implementation question

Re: Constraint implementation question

From: <toneczar_at_erols.com>
Date: Wed, 02 Dec 1998 14:11:01 GMT
Message-ID: <743hpj$kr2$1@nnrp1.dejanews.com>


dan.hield_at_cwcom.net wrote:

> I have an Oracle7 database on which I wish to enforce a table column to
> only contain upper case text. Can anyone tell me if this can be implemented
> declaratively or must it be done with the use of a trigger? Which ever
> the case, can you offer any suggestions that would help me do such a thing?

You have to do it via triggers. Here's an example BEFORE INSERT trigger to do it, supposing your table is named EMP and you have character columns ENAME and JOB. create or replace trigger emp_enforce_case   before insert or update
  on emp
  for each row
begin
  :new.ename := upper(:new.ename);
  :new.job := upper(:new.job);
end;
/

Chris



Chris Hamilton -- toneczar_at_erols.com
http://www.serve.com/cowpb/chamilton.html AVANCO International, Inc.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Dec 02 1998 - 08:11:01 CST

Original text of this message

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