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
How to get unique records from a table?
Explain spool.
How do I view a sql trace file?
How is a process of pl/sql compiled?
Is natural join same as inner join?
What are the different ddl commands in sql?
What are the constraints available in sql?
Sql technical questions
What is a record in a database?
Is progress software supports to ( pl/sql )?
what's the difference between a primary key and a unique key? : Sql dba
Write a query to display the current date in sql?
What is rtm in testing?
how would concatenate strings in mysql? : Sql dba
Explain what is dbms?