In apex.oracle.com (Version 4.2.2.00.11), I have tables BPR_PROC (parent) and BPR_RUNTM (child). I'm trying to do this operation:
alter table "BPR_RUNTM" add constraint
"BPR_RUNTM_FK1" foreign key ("PROC_NM") references "BPR_PROC" ("PROC_NM")
/I get the same error through the GUI or with the SQL Commands window.
The TABLE operation was not successful for the following reason:ORA-02270: no matching unique or primary key for this column-list>
I don't want to have a primary key defined but I have defined BPR_PROC_PK as a unique key:
CREATE TABLE "BPR_PROC"
("DSD_ID" VARCHAR2(10) NOT NULL ENABLE,
"PRNT_SEQ_ID" NUMBER(2,0) NOT NULL ENABLE,
"PROC_NM" VARCHAR2(30) NOT NULL ENABLE,
"PARNT_CHLD_IND" VARCHAR2(1),
"PARNT_PROC_NM" VARCHAR2(30),
"WR_APPRX_STRT_TM" VARCHAR2(5),
"OC_APPRX_STRT_TM" VARCHAR2(5),
"OO_APPRX_STRT_TM" VARCHAR2(5),
"KD_APPRX_STRT_TM" VARCHAR2(5),
"NTFCTN_REQ_TX" VARCHAR2(10),
"PROC_CYC_TX" VARCHAR2(25),
"JOB_LNG_NM" VARCHAR2(100)
)
/
CREATE INDEX "BPR_PROC_IDX1" ON "BPR_PROC" ("DSD_ID", "PRNT_SEQ_ID", "PROC_NM")
/
CREATE UNIQUE INDEX "BPR_PROC_PK" ON "BPR_PROC" ("PROC_NM")
/So, shouldn't this work? What am I doing wrong?
[Aside: I want a FK because some functionality in Master-Detail only seems to work if there is a FK.]
You can check it out here.
WS APEX_EXAMPLES_01
demo
demo
Thanks,
Howard