Solved

sql error

Posted on 2004-03-30
6
414 Views
Last Modified: 2007-12-19
Hello,

could anyone help me to fix the following error? many thx!


ALTER TABLE gp_ministry RENAME COLUMN
gp_ministry_key
TO gpages_ministry_key;

ALTER TABLE gp_ministry RENAME COLUMN
                               *
ERROR at line 1:
ORA-14155: missing PARTITION or SUBPARTITION keyword
0
Comment
Question by:antoniofong
6 Comments
 

Expert Comment

by:mr_oracle
Comment Utility
first if your table gp_ministry  is empty ,you can drop the column gp_ministry_key by the command: alter table gp_ministry drop gp_ministry_key;

second, add new column name gp_ministry_key by the command: alter table gp_ministry add gpages_ministry_key;

if your table is not empty you can move the data of that coumn to temp table , update the column gp_ministry to null, then you can drop it.

also, ithink you can rename a table but not a coulmn. thanks
0
 

Expert Comment

by:janu_s
Comment Utility
Try this

EXEC sp_rename 'table11.[feild1]', 'field2', 'COLUMN'
0
 

Author Comment

by:antoniofong
Comment Utility
sorry, it's not exactly what i wanted. thx anyway.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

by:fmonroy
Comment Utility
check COMPATIBLE value
maybe is too low and does not support RENAME COLUMN
0
 
LVL 22

Accepted Solution

by:
Helena Marková earned 50 total points
Comment Utility
You cannot rename column directly. You can do it the way described in this example (the registration is free):
(http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a85397/state17e.htm#2064978)

Example
Rename a Database Object Example
To change the name of table dept to emp_dept, issue the following statement:

RENAME dept TO emp_dept;

You cannot use this statement directly to rename columns. However, you can rename a column using this statement together with the CREATE TABLE statement with AS subquery. The following statements re-create the table static, renaming a column from oldname to newname:

CREATE TABLE temporary (newname, col2, col3)
    AS SELECT oldname, col2, col3 FROM static;

DROP TABLE static;

RENAME temporary TO static;


Your error ORA-14155 is because Oracle "thinks" COLUMN ought to be PARTITION or SUBRARTITION - see this example:
(http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a85397/statem2a.htm#2057289)
ALTER TABLE employee RENAME PARTITION emp3 TO employee3;
0
 
LVL 1

Expert Comment

by:suredazzle
Comment Utility
Thanks Hanka!

Oracle can't rename column with Partition.

Your work!

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now