Solved

sql error

Posted on 2004-03-30
6
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:mr_oracle
ID: 10716049
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
ID: 10716433
Try this

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

Author Comment

by:antoniofong
ID: 10716776
sorry, it's not exactly what i wanted. thx anyway.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:fmonroy
ID: 10719034
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
ID: 10720997
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
ID: 22801154
Thanks Hanka!

Oracle can't rename column with Partition.

Your work!

0

Featured Post

Webinar: MariaDB® Server 10.2: The Complete Guide

Join Percona’s Chief Evangelist, Colin Charles as he presents MariaDB Server 10.2: The Complete Guide on Tuesday, June 27, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about achieving the basic levels of HRIS security in the workplace.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

705 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