Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot increase column length (foreign key)

782102Jun 29 2010 — edited Jun 29 2010
I have the following DDL:

CREATE TABLE sections
(
section_name VARCHAR(25)
);
CREATE TABLE requirements
(
requirements_title VARCHAR(25),
section_name VARCHAR(25),
PRIMARY KEY(requirements_title, section_name),
CONSTRAINT fk_sections FOREIGN KEY(section_name) REFERENCES sections (section_name)
);

In SQL Developer, if I try to modify the section_name column (increase the column length from 25 to 100) in the sections table, it will complain that "Column section_name cannot be changed, it is referenced or used by a foreign key"! How do I change the column length?!?

Also, how do I use a user defined type as a primary key? I got section_name as a foreign key to many tables, I do not want to have to go to each table and manually update the column length. I can use a type instead like:
create or replace
type blog_name as object
(
section_name VARCHAR(25)
)

But I cannot use section_name as a primary key in the sections table if I alter the section_name column to use the section_name complex type because apparently...columns that use complex types cannot be declared as a primary key.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2010
Added on Jun 29 2010
3 comments
2,017 views