拆分Oracle Apex中选择列表的值列表

时间:2014-02-20 06:38:17

标签: sql database oracle oracle-apex

我正在研究Oracle Apex并尝试将值列表的结果加载到选择列表中,最后是一个组合框。我的代码如下。

select
field1 || ',' || field2 || ',' || field3 as dv, id rv 
from table
where id=1
order by 1

这段代码有效,但不是我需要的。我需要在3个不同的空格中打印过去3个结果,而不是只用一行逗号。我怎么能拆分它并在不同的行中打印它们,但在与Oracle Apex相同的选择列表(组合框)中。

希望你能帮助我。谢谢。

1 个答案:

答案 0 :(得分:0)

好吧,如果我理解了你的问题,你就会有一个包含三列的记录,并希望将它们显示为三条不同的行。

如果是的话,我会这样做:

 select decode(level, 1, field1
                    , 2, field2
                    , 3, field3) display_value
       ,id return_value /* this will return the same ID for each line, please review the logic */
   from table
  where id = 1
connect by level <= 3
  order by 1