you could copy the data out and then restore it with something like this...
note, if you have triggers or constraints this may not be appropriate
Main Topics
Browse All TopicsI have a NUMBER(8) column that
has only three digit numbers in it.
How can I do something like the below
to make the MAST_ID column smaller without
having to do alot of manually work ?
ALTER TABLE GML_P_COMPONENTS
CHANGE MAST_ID column to NUMBER(6)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
1. Create a table containing the values for insertion: create table GML_P_COMPONENTS_TEMP as select rowid altrowid, mast_id from GML_P_COMPONENTS;
2. Alter the table to allow nulls in mast_id , set the values to null then change the length: alter table GML_P_COMPONENTS modify (mast_id null);
OR
update GML_P_COMPONENTS set mast_id e = null;
alter table GML_P_COMPONENTS (mast_id NUMBER(6));
3. Now repopulate the column and get rid of the temporary table:
update GML_P_COMPONENTS set mast_id = (select mast_id from GML_P_COMPONENTS_TEMP where altrowid = GML_P_COMPONENTS .rowid);
drop table GML_P_COMPONENTS_TEMP ;
Below are the steps I did:
1. disable "mast_id" PK and FKs to parent and child tables
2. run below
3. enable "mast_id" PK and FKs to parent and child tables
--------------------------
CREATE TABLE temp_data
AS
SELECT ROWID rid, mast_id FROM gml_p_components;
COMMIT;
--------------------------
UPDATE gml_p_components
SET mast_id = NULL;
--------------------------
ALTER TABLE gml_p_components MODIFY (mast_id NUMBER(6));
--------------------------
UPDATE gml_p_components g
SET mast_id =
(SELECT mast_id
FROM temp_data
WHERE rid = g.ROWID);
COMMIT;
--------------------------
drop TABLE temp_data;
Business Accounts
Answer for Membership
by: sdstuberPosted on 2009-10-22 at 08:48:28ID: 25635594
the syntax would be
alter table gml_p_components modify (mast_id number(6))
but the column must be empty (all null) to decrease the precision