简体   繁体   English

ORACLE APEX PLSQL-LOV LIST,如何将静态值作为列表中的最后一个值?

[英]ORACLE APEX PLSQL - LOV LIST, how to have static value as last value in list?

I have a lov list with an sql query to dynaically fill it in depending on other fields, however, i'd like the last value in the list to be 'Other' no matter what the sql query brings back. 我有一个带有SQL查询的lov列表,可以根据其他字段动态填充它,但是,无论该SQL查询返回什么内容,我都希望列表中的最后一个值为“ Other”。

select EMP_NAME as d,
       EMP_NAME as r
  from EMP 
  WHERE EMP_NAME = :P09_CAT
 order by 1

There is declarative functionality built in for this common purpose. 为此,内置了声明性功能。 See just before 13.2.3 http://docs.oracle.com/database/apex-5.1/HTMDB/managing-page-level-items-in-page-designer.htm#HTMDB29715 请参见13.2.3之前的版本http://docs.oracle.com/database/apex-5.1/HTMDB/managing-page-level-items-in-page-designer.htm#HTMDB29715

Check the "List of Values" set of attributes for the item, specifically "Display null value", "Null Display Value". 检查项目的“值列表”属性集,特别是“显示空值”,“空显示值”。 Ensure the first is checked, and the latter says 'Other'. 确保检查第一个,然后检查是否为“其他”。

Alternatively, if you want specific data in your LOV you can add a UNION ALL, eg: 或者,如果您希望在LOV中添加特定数据,则可以添加UNION ALL,例如:

select d, r from (
  select EMP_NAME as d,
         EMP_NAME as r,
         row_number() over (order by emp_name) s
  from EMP 
  WHERE EMP_NAME = :P09_CAT
  union all
  select 'Other','Other',9999999999 from dual
) order by s

Create event on page load and use this javascript: 在页面加载时创建事件并使用以下javascript:

var x = document.getElementById("P605_NEW");
var option = document.createElement("option");
option.text = "Other";
x.add(option);

Where my select list is P605_NEW 我的选择列表是P605_NEW

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM