前面有提到过5分钟就可以做好一个查询页面,这个是ORACLE APEX比较牛逼的功能!

但是实际情况可能是:

  • 1:查询比较复杂的业务,往往有上十几张表之间的关联,如果用标准功能,查询很慢,性能会有影响!

  • 2:查询条件对用户不够友好,

  • 3:当查询条件有lov, 子查询的时候很难实现

Oracle APEX开发基础篇:5分钟做好一个增删改查的界面,StepByStep!!

那么我们就会需要先摆好的条件,并给他们做好lov,多选等等定制! 点查询按钮,在交互式网格或者交互式报表中显示结果!

场景:查询EMP表,

需要:按照查询条件1:部门可以多选 2:指定薪水范围,3指定职务的组合查询

我们先来看看效果

那么我们是怎么实现的呢?分以下几个步骤:

隐藏内容

此处内容需要权限查看

  • 普通30积分
  • 会员免费
  • 永久会员免费推荐
会员免费查看

这样,我们一个自定义查询条件的查询就做完了,完全达到了上面的效果,符合预期

付上用到的table和数据!

 
create table TTIAPEX.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)
)
 
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7839, null, 'CLERK', null, null, null, null, null);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7698, 'BLAKE', 'MANAGER', 7839, to_date('01-05-1981', 'dd-mm-yyyy'), 2850, null, 30);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7782, 'CLARK', 'MANAGER', 7839, to_date('09-06-1981', 'dd-mm-yyyy'), 2450, null, 10);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7566, 'JONES', 'MANAGER', 7839, to_date('02-04-1981', 'dd-mm-yyyy'), 2975, null, 20);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7788, 'SCOTT', 'ANALYST', 7566, to_date('09-12-1982', 'dd-mm-yyyy'), 3000, null, 20);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7902, 'FORD', 'ANALYST', 7566, to_date('03-12-1981', 'dd-mm-yyyy'), 3000, null, 20);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7369, 'SMITH', 'CLERK', 7902, to_date('17-12-1980', 'dd-mm-yyyy'), 800, null, 20);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7499, 'ALLEN', 'SALESMAN', 7698, to_date('20-02-1981', 'dd-mm-yyyy'), 1600, 300, 30);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7521, 'WARD', 'SALESMAN', 7698, to_date('22-02-1981', 'dd-mm-yyyy'), 1250, 500, 30);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7654, 'MARTIN', 'SALESMAN', 7698, to_date('28-09-1981', 'dd-mm-yyyy'), 1250, 1400, 30);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7844, 'TURNER', 'SALESMAN', 7698, to_date('08-09-1981', 'dd-mm-yyyy'), 1500, 0, 30);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7876, 'ADAMS', 'CLERK', 7788, to_date('12-01-1983', 'dd-mm-yyyy'), 1100, null, 20);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7900, 'JAMES', 'CLERK', 7698, to_date('03-12-1981', 'dd-mm-yyyy'), 950, null, 30);
insert into TTIAPEX.EMP (empno, ename, job, mgr, hiredate, sal, comm, deptno)
values (7934, 'MILLER', 'CLERK', 7782, to_date('23-01-1982', 'dd-mm-yyyy'), 1300, null, 10);
commit;
 

发表回复

您的电子邮箱地址不会被公开。