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: How to Update a UNIQUE field ?

Re: How to Update a UNIQUE field ?

From: J.P. <jp_boileau_at_yahoo.com>
Date: 17 Apr 2002 05:24:14 -0700
Message-ID: <7e388bc3.0204170424.967898c@posting.google.com>


I think that you are trying to update a column based on a sequence. It's pretty easy. Here's how:

SQL> create table t1 (c1 number(9), data varchar2(40));

Table created.

SQL> create sequence s1 start with 1 increment by 1 nocache;

Sequence created.

SQL> insert into t1 values (null, 'This is a test')

1 row created.

SQL> update t1 set c1 = s1.nextval;

9 rows updated.

SQL> select c1 from t1;

        C1


         1
         2
         3
         4
         5
         6
         7
         8
         9

9 rows selected.

Voila!

JP

"R Chin" <rchin_at_panix.com> wrote in message news:<a9hj3a$rg5$1_at_reader1.panix.com>...
> MY_TAB gets loaded daily, one UNIQUE-indexed field COL_UNIQ does NOT get
> values in the loading....
> I need to populate this field with unique values....
>
> How can I UPDATE this field with (where is null) values (from a SEQUENCE) ?
>
> Thanks
>
> Robert
Received on Wed Apr 17 2002 - 07:24:14 CDT

Original text of this message

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