【发布时间】:2012-04-11 19:05:14
【问题描述】:
我正在尝试使用 oracle 10g 创建一个图书馆系统(学校作业),但我在创建简单的 APEX 报告和表单时遇到了困难,错误消息显示:
ORA-20001:无法创建模块。 ORA-20001: 创建页面错误。 ORA-20001: 无法创建表单页面。 ORA-20001: 错误页面 = 8 item="P8_BRANCHID" id="" ORA-20001: 错误页面=8 item="P8_BRANCHID" id="" 与现有的应用程序级项具有相同的名称。 ORA-0000: 正常,顺利完成
无法创建应用程序。
这是我的架构,以防我做错了什么:
create table publisher(
PublisherName varchar2(30) not null,
Address varchar2(30) not null,
Phone number(20),
constraint publisher_pk primary key (PublisherName)
);
create table book(
BookId number(4) not null,
Title varchar2(50) not null,
PublisherName varchar2(30) not null,
constraint book_pk primary key (BookId),
constraint book_fk foreign key (PublisherName)
references publisher (PublisherName)
);
create table bookauthors(
BookId number(4) not null,
AuthorName varchar2(30) not null,
constraint bookauthors_pk primary key (BookId,AuthorName),
constraint bookauthors_fk foreign key (BookId) references book (BookId)
);
create table librarybranch(
BranchId number(4) not null,
BranchName varchar2(30) not null,
Address varchar2(30) not null,
constraint librarybranch_pk primary key (BranchId)
);
create table borrower(
CardNo number(4) not null,
BName varchar2(30) not null,
Address varchar2(30) not null,
Phone number(20) not null,
constraint borrower_pk primary key (CardNo)
);
create table bookcopies(
BookId number(4) not null,
BranchId number(4) not null,
No_Of_Copies number(4) not null,
constraint bookcopies_pk primary key (BookId,BranchId),
constraint bookcopies_fk foreign key (BookId) references book (BookId),
constraint bookcopies2_fk foreign key (BranchId) references librarybranch (BranchId)
);
create table bookloans(
BookId number(4) not null,
BranchId number(4) not null,
CardNo number(4) not null,
DateOut date,
DueDate date,
constraint bookloans_pk primary key (BookId,BranchId,CardNo),
constraint bookloans_fk foreign key (BookId) references book (BookId),
constraint bookloans2_fk foreign key (BranchId) references librarybranch (BranchId),
constraint bookloans3_fk foreign key (CardNo) references borrower (CardNo)
);
谢谢。
【问题讨论】:
-
与您的问题无关,但我认为
bookloans表需要一些调整。 FK 1 和 2 应合二为一:constraint bookloans_fk foreign key (BookId, BranchId) references librarybranch (BookId, BranchId) -
你也可以添加一个检查约束
DateOut < DueDate。 -
还有一种强制图书馆没有借出 4(或 100)份只有 3 份的书的方法。 (这比对架构的简单更改更难)
-
不确定,但我认为通过删除架构(对于未来的访问者)可以改善这个问题,因为它与问题无关。
标签: sql oracle oracle10g oracle-apex