- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Oracle 8i Question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 07:03 AM
тАО11-08-2005 07:03 AM
Oracle 8i Question
We have a column in a table called "comment". It's been there forever but now it has been requested to get changed since it is a reserved word. It seems simple enough to add the new column name, update it's contents with the existing data and then dropping the old name. However, the update fails becuse of the reserved word usage:
update tablename set new_commnet = comment;
ERROR at line 1:
ORA-00936: missing expression
update tablename set new_commnet = "comment"
ERROR at line 1:
ORA-00904: invalid column name
Is there another way around this? There is "comment" data in some of these rows so "create table tablename as" won't work either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 07:20 AM
тАО11-08-2005 07:20 AM
Re: Oracle 8i Question
If I remember I'll ask my oracle guy to read ths.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 07:23 AM
тАО11-08-2005 07:23 AM
Re: Oracle 8i Question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 07:35 AM
тАО11-08-2005 07:35 AM
Re: Oracle 8i Question
update tablename t1
set new_commnet = (select comment from tablename t2 where t1.p_key = t2.p_key);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 07:53 AM
тАО11-08-2005 07:53 AM
Re: Oracle 8i Question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 08:19 AM
тАО11-08-2005 08:19 AM
Re: Oracle 8i Question
Thank you for you help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 03:20 PM
тАО11-08-2005 03:20 PM
Re: Oracle 8i Question
You cannot rename a column in Oracle 8i.
In Oracle8i, you can drop a column from a table but not rename.
The way to do it is to use a view. You can minimize the impact on applications by doing simply:
rename TableName to TableName_TBL;
create view TableName
as
select c1 New_Name_For_C1, c2, c3, .... cn from TableName_Tbl;
After that you must grant on the view the same privileges that you had normally granted on the table.
This way, all existing applications will see the new column name with the old table name.
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 03:39 PM
тАО11-08-2005 03:39 PM
Re: Oracle 8i Question
i tried same as you above and it worked!
please check.
yogeeraj@MYDB.MU> create table t1 (id number(1), "COMMENT" varchar2(100));
Table created.
Elapsed: 00:00:00.02
yogeeraj@MYDB.MU> desc t1
Name
Null? Type
-------------------------------------------------------------------------------
ID
NUMBER(1)
COMMENT
VARCHAR2(100)
yogeeraj@MYDB.MU> alter table t1 add new_commnet varchar2(100);
Table altered.
Elapsed: 00:00:00.08
yogeeraj@MYDB.MU> update t1 set new_commnet=t1."COMMENT";
0 rows updated.
Elapsed: 00:00:02.53
yogeeraj@MYDB.MU> desc t1
Name
Null? Type
-------------------------------------------------------------------------------
ID
NUMBER(1)
COMMENT
VARCHAR2(100)
NEW_COMMNET
VARCHAR2(100)
yogeeraj@MYDB.MU> alter table t1 drop column "COMMENT";
Table altered.
Elapsed: 00:00:00.53
yogeeraj@MYDB.MU> desc t1
Name
Null? Type
-------------------------------------------------------------------------------
ID
NUMBER(1)
NEW_COMMNET
VARCHAR2(100)
yogeeraj@MYDB.MU>
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-08-2005 08:44 PM
тАО11-08-2005 08:44 PM
Re: Oracle 8i Question
I'll do it this way:
- Make sure you have a good database backup;
- Test it in a Test database if possible;
- Now the commands:
create table bak_comment_table_name as
select a...., a.comments new_comments, a...
from
desc bak_comment_table_name; -- to confirm the new comment column is new_comments...
drop table
create table
select * from bak_comment_table_name;
PS: try Yogeeraj's suggestion first since I didn't test this one...
Best Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2005 12:09 AM
тАО11-09-2005 12:09 AM
Re: Oracle 8i Question
Thank you for you help!