change the datatype of a field without empty the existing one. [message #10867] |
Sat, 21 February 2004 00:11 |
shahzad
Messages: 17 Registered: February 2002
|
Junior Member |
|
|
dear sir, pls update the table field....or change the datatype of existing field....
.......................example.........................
field1 number(6) i want to change this into
field varchar2(10)....it is possible.....
i get the following error....
ERROR at line 2:
ORA-01439: column to be modified must be empty to change datatype
pls help mei urgent
|
|
|
|
|
Re: change the datatype of a field without empty the existing one. [message #10879 is a reply to message #10868] |
Sat, 21 February 2004 12:31 |
William Robertson
Messages: 1643 Registered: August 2003 Location: London, UK
|
Senior Member |
|
|
> You can not change the name
Well in 9i (at last) you can:
SQL*Plus: Release 9.2.0.1.0 - Developer's Release on Sat Feb 21 22:04:00 2004
SQL> CREATE TABLE testit (id INTEGER PRIMARY KEY);
Table created.
SQL> desc testit
Name Null? Type
----------------------------- -------- --------------------
ID NOT NULL NUMBER(38)
SQL> ALTER TABLE testit RENAME COLUMN id TO testit_id;
Table altered.
SQL> desc testit
Name Null? Type
----------------------------- -------- --------------------
TESTIT_ID NOT NULL NUMBER(38)
SQL> @constr testit
Type Constraint name Definition Status
-------- ------------------------- -------------------------------------------------- --------
Primary SYS_C001660 Primary key (TESTIT_ID) ENABLED
SQL> ALTER TABLE testit RENAME CONSTRAINT SYS_C001660 TO testit_pk;
Table altered.
SQL> @constr
Type Constraint name Definition Status
-------- ------------------------- -------------------------------------------------- --------
Primary TESTIT_PK Primary key (TESTIT_ID) ENABLED
SQL>
|
|
|