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.

Answers were Sorted based on User's Feedback



Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / rinson

It will raise error ora-1439 column to be modifiedy must be
empty to change datatype.

Is This Answer Correct ?    26 Yes 2 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / subbarayulu

It Will not work properly. when ever the table with data
user can't chage the column's datatype. It allows to
increase the size of the data type only.

Is This Answer Correct ?    14 Yes 2 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / imran

It wo'nt work because if there is an data exist in
(id number(9)).You cannot modify if colmun is not empty.

Is This Answer Correct ?    15 Yes 5 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / sathish p

We cant change column datatype while the column having
values.. Bcos error will come when u run the Alter table
modify statement...

Is This Answer Correct ?    5 Yes 1 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / ramesh

It will work 100%.
becos. we are increasing the length. if we are decreasing
the length then it gives error.

Is This Answer Correct ?    3 Yes 0 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / 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

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / lakshmanakumar

There should be error raised as below
ORA-01439: column to be modified must be empty to change
datatype

Is This Answer Correct ?    2 Yes 1 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / shailesh j

If column contains data then we can only modify size of
column without changing its data type. But if the column is
empty then we can modify its size as well data type.

Is This Answer Correct ?    1 Yes 0 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / krishna

It wil not work

Is This Answer Correct ?    2 Yes 2 No

Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table..

Answer / reddi

It won't work coz number can't datatype can't be changed to
varchar. If data does not exits then its work fine.

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

What is the process of copying data from table a to table b?

0 Answers  


Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy

6 Answers   Target,


What are the most important characteristics of pl/sql?

0 Answers  


What is a cursor ? Why Cursor is required ?

3 Answers  


What does select count (*) mean in sql?

0 Answers  


What is blind sql injection?

0 Answers  


How do I create a sql database?

0 Answers  


in sql table follw columns r their vehicle_no|servicetype|date|location| 1234 |1FS |1-JAN|PUNE| 4561 |2FS |5-JAN|PUNE| 1234 |PS |7-JAN|PUNE| 1234 |PS |15-JAN|MUMB| i want o/p below vehicleno|1fs|1fsdate|1fslocation|1ps|1PSDATE|1PSLOC|2PS|2PS DATE|2PSLOCA e.g 1234|1FS|1JAN|PUNE|1PS|7JAN|PUNE|2PS|15JAN|MUMBAI PLS help me out to execute using sql query

1 Answers  


What is rank function in sql?

0 Answers  


What is the full form of sql?

1 Answers  


What is the starting oracle error number?

0 Answers  


What is a nested table in word?

0 Answers  


Categories