Create table emp
(id number(9), name varchar2(20),salary
number(9,2));
The table has 100 records after table created.Now i nee to
change id's Datatype is to be Varchar2(15). now
Alter table emp modify(id varchar2(15),name varchar2(20),
salary number(9,2));
Whether it will work or returns error? post answer with
explanation.
Answer Posted / abhishekjaiswal
They are asking change datatype from number to varchar2..So it is not possible if table have data..this will give error 'ORA-01439: column to be modified must be empty to change datatype'.You can alter table and modify that column in same data type.
See Example
select * from a;
N F
----- -------------------
5
1
3
alter table a modify (n varchar2(10))
*
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype
1* alter table a modify (n number)
SQL> /
Table altered.<<<<<<<<<<<<<<<<<
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is t sql used for?
Can a table have no primary key?
Is there a 64 bit version of ssms?
What are the dml statements?
what is a unique key ? : Sql dba
What is case function?
What is the difference between left join and right join?
What are the string functions in sql?
What is the difference between nested table and varray?
What is sql stand for?
Is join same as left join?
How to display the records between two range in Oracle SQL Plus?
Does sqlite need a server?
What are the various levels of constraints?
What are the two types of exceptions.