Taconvino
asked on
Oracle Version, TOAD VI and Drop Column
Hi,
I'm trying to delete a column from an Oracle database... I know there's a SQL command to do this, but only for version 8i and newer. So, my questions are:
1.- How can I retrieve the version of my Oracle DB using TOAD (you know, using only SQL)
2.- If my version is older than 8i, how do I drop the column
That's about it.
Thanks!
TCV
I'm trying to delete a column from an Oracle database... I know there's a SQL command to do this, but only for version 8i and newer. So, my questions are:
1.- How can I retrieve the version of my Oracle DB using TOAD (you know, using only SQL)
2.- If my version is older than 8i, how do I drop the column
That's about it.
Thanks!
TCV
ASKER
OK! Now I got the version, but when I run the Alter, I get this error message:
The following error has occurred:
ORA-00905: missing keyword
And leaves the word "column" selected.
So, I guess the command doesn't work for Oracle8 Release 8.0.4.0.0. Please, any other help would be great!
TCV
The following error has occurred:
ORA-00905: missing keyword
And leaves the word "column" selected.
So, I guess the command doesn't work for Oracle8 Release 8.0.4.0.0. Please, any other help would be great!
TCV
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is another way:
you can create a VIEW on top of that table:
create view <new_view_name>
as
select col1, col2, ....coln --Exclude the column-to-be-dropped
from <table_name>;
and direct users to use this view instead of this table.
I like this option better, because it does not disrupt your table structure and don't need to re-create all the constraints.
you can create a VIEW on top of that table:
create view <new_view_name>
as
select col1, col2, ....coln --Exclude the column-to-be-dropped
from <table_name>;
and direct users to use this view instead of this table.
I like this option better, because it does not disrupt your table structure and don't need to re-create all the constraints.
ASKER
So, I have to recreate the table with a new name, then drop the old table, and then rename the new table, right? Does the rename command work for Oracle8?
TCV
TCV
Nope
ASKER
Hummm... that leaves me right in the start, right? Any way, I can do the same process twice to get where I want. The view could be better, under other circumstances... anyway, Thanks!
TCV
TCV
taconvino:
Rename table actually works in Oracle8 .It's getting rusty on me...I havenot used 8 for coon's age.
Rename table actually works in Oracle8 .It's getting rusty on me...I havenot used 8 for coon's age.
ASKER
You're kidding! Can you post the correct syntax please? Thanks!
TCV
TCV
easy:
just
rename <table_name> to <new_table_name>;
alter table <table_name> rename to <new_table_name>;
just
rename <table_name> to <new_table_name>;
alter table <table_name> rename to <new_table_name>;
ASKER
I'll check this on monday. Thanks again!
TCV
TCV
select * from v$version;
2. alter table <table_name> drop column <column_name>;