Changing data type of non-empty table
441344Sep 13 2007 — edited Sep 13 2007Hi,
I want to change the data type of a column in a table from NUMBER to VARCHAR2. The table isn't empty. Is there a way I can change the data type without removing the data from the table because the table is big.
Would appreciate your thoughts on it.
Pasted below is a sample table:
CREATE TABLE test1 (
c1 NUMBER(5),
c2 NUMBER(3)
);
INSERT INTO test1 VALUES (1,2);
INSERT INTO test1 VALUES (1,2);
INSERT INTO test1 VALUES (1,2);
INSERT INTO test1 VALUES (1,2);
INSERT INTO test1 VALUES (1,2);
INSERT INTO test1 VALUES (1,2);
INSERT INTO test1 VALUES (1,2);
COMMIT;
ALTER TABLE test1 MODIFY (c2 VARCHAR2(25));
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype
Thanks and Regards,
Muthu