Question asked by Visitor Mohit
Can anyone help me how to alter a type in SQL.I have an ADT called address and I want to alter the size of its attribute called houseno of type varchar2 to 30.
Question asked by Visitor Mohit
Can anyone help me how to alter a type in SQL.I have an ADT called address and I want to alter the size of its attribute called houseno of type varchar2 to 30.
Alter typemodify ( ( ));
This should work
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.
-sutnarcha-
I think followin should work for you
ALTER TABLE
MODIFY houseno varchar2(30) ;
01-24-2008 #4Junior Member
- Join Date
- Jan 2008
- Answers
- 24
Re: How to alter a type in SQL
if we wnt to change a column defintion first store all the data in that column to some where and set all the values to be modified in that column to null and then follo below mentioned
sql> Alter table modify
();
01-25-2008 #5Junior Member
- Join Date
- Jan 2008
- Answers
- 3
Re: How to alter a type in SQL
Alter table table_name MODIFY(houseno varchar2(30));
01-25-2008 #6Contributing Member
- Join Date
- Sep 2007
- Answers
- 35
Re: How to alter a type in SQL
alter table tablename
modify column_name varchar2(30);
01-26-2008 #7Contributing Member
- Join Date
- Jul 2007
- Answers
- 42
Re: How to alter a type in SQL
hi following answer
alter table table_name modify column_name datatype;
suppose add column
alter table table_name add column_name datatype;
drop in particular column
alter table table_name drop column column_name;
01-28-2008 #8Expert Member
- Join Date
- Sep 2007
- Answers
- 697
Re: How to alter a type in SQL
You can alter a type in sql using
ALTER TABLE[MODIFY
Alter Table address modify (houseno varchar2(30))
But you should keep in mind the following points while altering a type
(1) You may not change a column containing nulls from null to not null
(2) You may not add a new column that is not null. Make it null, full it completely and then change it to not null
(3) You may not decrease the size of a columns or change its data type , unless it contains no data (especially for numeric data)
(4) You may not use the modify option to define constraints on a column except for not null
02-06-2008 #9Junior Member
- Join Date
- Nov 2007
- Answers
- 2