Bug in version 11.0.3.1770: SQL window grid "List-of-values" (foreign key) does not always work

Claus Pedersen

Member³
I have a table with a foreign key to another table (e.g. scott/tiger emp with foreign key to dept.dept_no) and edit the table data in the SQL window grid. I have (amongst others) the values 1, 11, 40, 41 in the list of department numbers.

In a new record, I use the dropdown to show the list. I want to select 41 and first type "4" on the keyboard. The list shifts to the row with 40. I then press "1" and the lists shifts to 41. I press Enter to select this value. This works as expected.

Now, again on a new record, I want to select 10. I open the list and press "1", the list shifts to 1. If I press "0" to shift to 10, the list stays on 1 and if I press Enter, the value 10 in the field is replaced by 1, because the list was not updated.

This can not be by design, so it must be fixed.
 
How to reproduce: Run the following script on e.g. the Scott/Tiger schema (ignore SQL warnings if e.g. the tables or the rows already exist):

SQL:
create table DEPT (
  deptno NUMBER(2) NOT NULL,
  dname  VARCHAR2(14),
  loc    VARCHAR2(13));

alter table DEPT add constraint DEPT_PK primary key (DEPTNO)

insert into DEPT (DEPTNO, DNAME, LOC) values (1, 'Test Dept. 1', 'Berlin');
insert into DEPT (DEPTNO, DNAME, LOC) values (10, 'ACCOUNTING', 'NEW YORK');
insert into DEPT (DEPTNO, DNAME, LOC) values (11, 'Test Dept. 11', 'Kassel');
insert into DEPT (DEPTNO, DNAME, LOC) values (20, 'RESEARCH', 'DALLAS');
insert into DEPT (DEPTNO, DNAME, LOC) values (30, 'SALES', 'CHICAGO');
insert into DEPT (DEPTNO, DNAME, LOC) values (40, 'OPERATIONS', 'BOSTON');
insert into DEPT (DEPTNO, DNAME, LOC) values (41, 'Test Dept. 41', 'Hamburg');
insert into DEPT (DEPTNO, DNAME, LOC) values (42, 'Test Dept. 42', 'Frankfurt');

create table EMP (
  empno    NUMBER(4) not null,
  ename    VARCHAR2(10),
  job      VARCHAR2(9),
  mgr      NUMBER(4),
  hiredate DATE,
  sal      NUMBER(7,2),
  comm     NUMBER(7,2),
  deptno   NUMBER(2));

alter table EMP add constraint EMP_PK primary key (EMPNO);

alter table EMP add constraint EMP_FK_DEPT foreign key (DEPTNO) references DEPT (DEPTNO);

insert into EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) values (7369, 'SMITH', 'CLERK', 7902, to_date('17-12-1980', 'dd-mm-yyyy'), 800.00, null, 10);
insert into EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) values (7499, 'ALLEN', 'SALESMAN', 7698, to_date('20-02-1981', 'dd-mm-yyyy'), 1600.00, 300.00, 30);
insert into EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) values (7521, 'WARD', 'SALESMAN', 7698, to_date('22-02-1981', 'dd-mm-yyyy'), 1250.00, 500.00, 30);

Then try to edit data from table EMP and use the drop-down on column DEPTNO and select 10 or 11 by typing the numbers and pressing Enter. Only 1 is selected. If you type 40 or 41, the correct department is selected.
 
Back
Top