I regularly have to change the structure of some fairly large tables (~200m
rows). Often we use the opportunity to do a full table rebuild if we want
to change other settings (such as index locations) but other times we would
prefer to modify the existing table.
I currently have the scenario where I need to add a single CHAR(1) column
to a 250m row table and populate it with a constant value (new records may
have a different value). The approach I am considering is:
1) alter table blah add (mycol char(1));
2) update blah set mycol = 'F '; {perhaps include a parallel hint on
this statement}
3) alter table blah modify mycol not null enable novalidate;
I was hoping to use "enable novalidate " to avoid a verification of all
records when I know they will be populated. However I noticed that a
describe on the table produces unexpected results. Here is a demo:
SQL > desc blah
Name Null? Type
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- -----
-- ---- ---- ---- ---- ---- ----
FIRSTCOL NUMBER
SQL > insert into blah (firstcol) values (1);
insert into blah (firstcol) values (1)
*
ERROR at line 1:
ORA-01400 (See ORA-01400.ora-code.com): cannot insert NULL into ( "SPARKY ". "BLAH ". "MYCOL ")
SQL > alter table blah modify mycol null;
Table altered.
Elapsed: 00:00:00.04
SQL > alter table blah modify mycol not null;
Table altered.
Elapsed: 00:00:00.06
SQL > desc blah;
Name Null? Type
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- -----
-- ---- ---- ---- ---- ---- ----
FIRSTCOL NUMBER
MYCOL NOT NULL CHAR(1)
This is happening on Oracle 8.1.7.4 (running on Solaris) and is repeatable.
Whenever "enable novalidate " is used the constraint doesn 't appear. Trying
to insert null data shows the constraint is actually there, just not
appearing in describe.
Any ideas? Any workarounds? Fixed in Oracle 9 (although we are bound to 8
due to applications that connect)?
Thanks in advance,
Mark.
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < <---- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Privileged/Confidential information may be contained in this message.
If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone.
In such a case, you should destroy this message and kindly notify the sender by reply e-mail or by telephone on (03) 9612-6999 or (61) 3 9612-6999.
Please advise immediately if you or your employer does not consent to Internet e-mail for messages of this kind.
Opinions, conclusions and other information in this message that do not relate to the official business of Transurban Infrastructure Developments Limited and CityLink Melbourne Limited shall be understood as neither given nor endorsed by them.
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < <---- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --