【问题标题】:Joining Oracle ApEx collections to actual tables将 Oracle ApEx 集合连接到实际表
【发布时间】:2011-07-17 14:12:35
【问题描述】:

在 Oracle ApEx 中,是否可以将架构中的实际表连接到 Oracle ApEx 集合,因为我在这样做时遇到了麻烦?

基本上有以下几种情况:

select c001,  -- employee id from collection
       c002,
       c003   -- employee dept no from collection
from   apex_collections,
       emp
where  emp.id = c001
and    emp.deptno = c003;

以上是可能的还是我错过了什么?

【问题讨论】:

  • 是的,有可能,你到底有什么问题?
  • 嗨@Tony,设法解决了这个问题,只是不知道如何将该线程的状态更改为已解决。
  • 这个答案可能对其他人有帮助吗?如果是这样,请添加您自己的答案 - 但不确定您是否可以接受。否则,如果您无法删除问题,我们可以关闭它。
  • 如果放弃应该删除。

标签: sql plsql oracle10g oracle-apex


【解决方案1】:

我们可以将 apex 集合与我们的模式表结合起来。它会起作用的。。

select c001,  -- employee id from collection
       c002,
       c003   -- employee dept no from collection
from   apex_collections,
       emp emp
where  emp.empno = c001
and    emp.deptno = c003;

【讨论】:

    【解决方案2】:
    /*
    I have this table person (personid, ...., telephone_numbers)
    in which the column "telephone numbers" is a nested table.
    In the example below I'm trying to use this into collections and display the count of telephone numbers that the row has.
    -- */
    DECLARE
      telno telephone_number_table; -- variable name and type.
      cnt INTEGER;
    BEGIN
      SELECT p.telephone_numbers -- accept the nested table into the variable
        INTO telno
        FROM person p
       WHERE p.personid = 1;
    
      SELECT COUNT(*) -- I'm using COUNT(*) here, you can use your valid column listing.
        INTO cnt
        FROM person p
        CROSS JOIN TABLE(telno) tel -- use a cross join with alias
       WHERE p.personid = 1;
    
      dbms_output.put_line(cnt);
    END;
    /
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      相关资源
      最近更新 更多