Oracle APEX 主详细信息页面创建:ORA-06531 错误
Oracle APEX master detail page creation: ORA-06531 error
我正在使用以下 PL/SQL 方案使用 APEX 创建一个鸡群管理应用程序:
-- SHEEP table
create table sheep (
sheep_id number(*,0) generated by default on null as identity,
eid varchar2(6) not null,
sex varchar2(6) not null,
name varchar2(45),
breed varchar2(255) not null,
birth date,
sheep_state varchar2(45) not null,
lambs number(*,0) not null,
lambs_sets number(*,0) not null,
markings varchar2(4000),
note varchar2(4000),
constraint sheep_pk primary key (sheep_id)
);
-- EVENT table
create table event (
event_id number(*,0) generated by default on null as identity,
sheep_id varchar2(6) not null,
name varchar2(255) not null,
event_date date not null,
description varchar2(4000) not null,
location varchar2(45) not null,
constraint event_pk primary key (event_id)
);
-- SALE table
create table sale (
sale_id number(*,0) generated by default on null as identity,
sheep_id varchar2(6) not null,
price number(*,2) not null,
sale_date date not null,
location varchar2(45) not null,
note varchar2(4000),
constraint sale_pk primary key (sale_id)
);
在此方案中,SALE 和 EVENT table 引用 EID 字段[= SHEEP table 的 32=](5 个数字和一个字母的唯一标识符 - 代表他们耳朵上的黄色标签)。我正在尝试创建一个 主详细信息页面 ,它将 link 一只绵羊的特定事件(发生在绵羊身上的事情)和销售历史记录(如果已售出,何时, 哪里, 多少钱).
我尝试同时使用创建应用程序向导和创建页面向导,但每次我都遇到相同的错误:
Ajax call returned server error ORA-06531: Reference to uninitialized collection for Execute PL/SQL Code.
它仍然让我在向导中继续,但是当我想 select 详细信息 tables(销售和活动)时,它们甚至没有出现在 select 中ing 列表 (cf here).
有人有想法吗?我是 APEX 的新手,我可能错过了一些东西。另外,如果您对我的关系方案有任何建议(更改,改进效率),请不要犹豫告诉我。
提前致谢!
event 和 sheep 之间没有任何关系,sale 和 sheep 之间也没有关系。您声明 SALE 和 EVENT table 引用了 SHEEP table 的 EID 字段,但数据库不知道这一点,因为该关系尚未通过外键定义。 table 中的外键引用另一个 table 的 主键 ,您不能引用另一列(如 EID),即使那是独一无二。
在您的脚本中,在所有 table 中创建 sheep_id NUMBER
并在 SALE 和 EVENT 中创建一个外键。像这样:
-- SHEEP table
create table sheep (
sheep_id number(*,0) generated by default on null as identity,
eid varchar2(6) not null,
sex varchar2(6) not null,
name varchar2(45),
breed varchar2(255) not null,
birth date,
sheep_state varchar2(45) not null,
lambs number(*,0) not null,
lambs_sets number(*,0) not null,
markings varchar2(4000),
note varchar2(4000),
constraint sheep_pk primary key (sheep_id)
);
-- EVENT table
create table event (
event_id number(*,0) generated by default on null as identity,
sheep_id number not null,
name varchar2(255) not null,
event_date date not null,
description varchar2(4000) not null,
location varchar2(45) not null,
constraint event_pk primary key (event_id),
constraint fk_event_sheep
foreign key (sheep_id)
references sheep(sheep_id)
);
-- SALE table
create table sale (
sale_id number(*,0) generated by default on null as identity,
sheep_id number not null,
price number(*,2) not null,
sale_date date not null,
location varchar2(45) not null,
note varchar2(4000),
constraint sale_pk primary key (sale_id),
constraint fk_sale_sheep
foreign key (sheep_id)
references sheep(sheep_id)
);
这是在关系数据库系统中创建主从关系的方法,它应该也允许您在 APEX 中创建主从表单。
我正在使用以下 PL/SQL 方案使用 APEX 创建一个鸡群管理应用程序:
-- SHEEP table
create table sheep (
sheep_id number(*,0) generated by default on null as identity,
eid varchar2(6) not null,
sex varchar2(6) not null,
name varchar2(45),
breed varchar2(255) not null,
birth date,
sheep_state varchar2(45) not null,
lambs number(*,0) not null,
lambs_sets number(*,0) not null,
markings varchar2(4000),
note varchar2(4000),
constraint sheep_pk primary key (sheep_id)
);
-- EVENT table
create table event (
event_id number(*,0) generated by default on null as identity,
sheep_id varchar2(6) not null,
name varchar2(255) not null,
event_date date not null,
description varchar2(4000) not null,
location varchar2(45) not null,
constraint event_pk primary key (event_id)
);
-- SALE table
create table sale (
sale_id number(*,0) generated by default on null as identity,
sheep_id varchar2(6) not null,
price number(*,2) not null,
sale_date date not null,
location varchar2(45) not null,
note varchar2(4000),
constraint sale_pk primary key (sale_id)
);
在此方案中,SALE 和 EVENT table 引用 EID 字段[= SHEEP table 的 32=](5 个数字和一个字母的唯一标识符 - 代表他们耳朵上的黄色标签)。我正在尝试创建一个 主详细信息页面 ,它将 link 一只绵羊的特定事件(发生在绵羊身上的事情)和销售历史记录(如果已售出,何时, 哪里, 多少钱).
我尝试同时使用创建应用程序向导和创建页面向导,但每次我都遇到相同的错误:
Ajax call returned server error ORA-06531: Reference to uninitialized collection for Execute PL/SQL Code.
它仍然让我在向导中继续,但是当我想 select 详细信息 tables(销售和活动)时,它们甚至没有出现在 select 中ing 列表 (cf here).
有人有想法吗?我是 APEX 的新手,我可能错过了一些东西。另外,如果您对我的关系方案有任何建议(更改,改进效率),请不要犹豫告诉我。
提前致谢!
event 和 sheep 之间没有任何关系,sale 和 sheep 之间也没有关系。您声明 SALE 和 EVENT table 引用了 SHEEP table 的 EID 字段,但数据库不知道这一点,因为该关系尚未通过外键定义。 table 中的外键引用另一个 table 的 主键 ,您不能引用另一列(如 EID),即使那是独一无二。
在您的脚本中,在所有 table 中创建 sheep_id NUMBER
并在 SALE 和 EVENT 中创建一个外键。像这样:
-- SHEEP table
create table sheep (
sheep_id number(*,0) generated by default on null as identity,
eid varchar2(6) not null,
sex varchar2(6) not null,
name varchar2(45),
breed varchar2(255) not null,
birth date,
sheep_state varchar2(45) not null,
lambs number(*,0) not null,
lambs_sets number(*,0) not null,
markings varchar2(4000),
note varchar2(4000),
constraint sheep_pk primary key (sheep_id)
);
-- EVENT table
create table event (
event_id number(*,0) generated by default on null as identity,
sheep_id number not null,
name varchar2(255) not null,
event_date date not null,
description varchar2(4000) not null,
location varchar2(45) not null,
constraint event_pk primary key (event_id),
constraint fk_event_sheep
foreign key (sheep_id)
references sheep(sheep_id)
);
-- SALE table
create table sale (
sale_id number(*,0) generated by default on null as identity,
sheep_id number not null,
price number(*,2) not null,
sale_date date not null,
location varchar2(45) not null,
note varchar2(4000),
constraint sale_pk primary key (sale_id),
constraint fk_sale_sheep
foreign key (sheep_id)
references sheep(sheep_id)
);
这是在关系数据库系统中创建主从关系的方法,它应该也允许您在 APEX 中创建主从表单。