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

Home -> Community -> Usenet -> c.d.o.server -> Re: TO_UPPER on entire table?

Re: TO_UPPER on entire table?

From: Noel <tbal_at_go2.pll-l>
Date: Fri, 08 Jul 2005 09:20:45 +0200
Message-ID: <dal9ns$223$1@inews.gazeta.pl>


User Rob Williamson wrote:

> To make sure all enties in one column are Upper Case you can do the
> following
>
> create table test2(
> lname varchar2(10) not null,
> fname varchar2(10),
> constraint test2_lname_ck CHECK ( TO_UPPER(lname)),
> constraint test2_fname_ck CHECK ( TO_UPPER(fname))
> );
>
>
> Is there away to just have one table level constraint that makes all
> columns in the whole table all upper case without having to write
> constraints for each column?
>

If your table exists, and has a lot of columns, and you want to add constraint to each column, you can use catalog entries for table to generate constraints.

--/ Example /--

SELECT
  'ALTER TABLE '||TABLE_NAME||' ADD CONSTRAINT TEST2_'||COLUMN_NAME||'_CK CHECK ( TO_UPPER('||COLUMN_NAME||'));'   FROM ALL_TAB_COLUMNS A
  WHERE A.table_name = 'ALL_TAB_COLUMNS';

-- 
Noel
Received on Fri Jul 08 2005 - 02:20:45 CDT

Original text of this message

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