Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is sql*loader?

1161


Will truncate release space?

931


What are the advantages of pl sql over sql?

1014


how to enter characters as hex numbers? : Sql dba

1028


what is collation? : Sql dba

1133


What is type and rowtype in pl sql?

1009


What is union and union all keyword in sql and what are their differences?

1089


Can we join same table in sql?

1003


What is difference between stored procedure and trigger?

1136


Is it possible to sort a column using a column alias?

1027


What are sql data types?

1003


what are the properties and different types of sub-queries? : Sql dba

1015


which tcp/ip port does sql server run on? : Sql dba

1009


What are variables in pl sql?

1147


how to get help information from the server? : Sql dba

921