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
Solved

sql error

Posted on 2004-03-30
6
419 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
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Read about achieving the basic levels of HRIS security in the workplace.
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…

790 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