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

SQL Error: ORA-01439: column to be modified must be empty to change datatype
01439. 00000 - "column to be modified must be empty to change datatype"

Is This Answer Correct ?    0 Yes 0 No

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

Answer / nilesh

It will not work,

If u have data in a table and u have to change data type
number to varchar2 then it will gives error, If u change
varchar2(100) column to char(200) it will work,
The number to varchar2 or varchar2 to number will not work
when u have data in table.

Is This Answer Correct ?    0 Yes 2 No

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

Answer / tajuddin

It will work your query 100% will work

Chers
Taj

Is This Answer Correct ?    9 Yes 16 No

Post New Answer

More SQL PLSQL Interview Questions

How do I filter in sql profiler?

0 Answers  


I have a table .in the table 100 recored is there .we have get the single row with out using clause..

3 Answers  


What is sql performance tuning?

0 Answers  


what is the difference between char and varchar data types? : Sql dba

0 Answers  


how to run 'mysql' commands from a batch file? : Sql dba

0 Answers  






what is overloading procedure or overloading function ?

3 Answers   Genpact,


Types of optimization?

6 Answers   Microsoft,


Hi All, I am new to both this blog and technology. I was able to see a response for one of the questions on triggers as below. I would like to know why are we using " if rtrim(to_char(sysdate,'day'))=rtrim('sunday') then" instead, can't we use " if sysdate = 'sunday' then". I can understand the use of "rtrim", but dont know y v r using to_char. I have seen this in many cases but did not get a convincible explaination. Please help me with this and do excuse if this question sounds silly. Thanks in advance...... create or replace trigger trg_sun before insert on <table name> begin if rtrim(to_char(sysdate,'day'))=rtrim('sunday') then raise_application_error(-20345,'no transaction in sunday'); end if; end trg_sun;

2 Answers  


How to write a query to show the details of a student from students table whose

0 Answers  


How do I find sql profiler?

0 Answers  


Why do we need databases?

0 Answers  


Can we rollback truncate?

0 Answers  


Categories