加入从pl / sql函数中选择数据的子查询

时间:2012-07-04 08:15:34

标签: sql oracle plsql

  1. 我需要加入该子查询,因为它返回多行。
  2. 加入子查询看起来像(我不知道确切的语法):

    select * from some_pl_sql_function(id_arg)
    
  3. 我需要将id_arg加入到某个表的列中。

  4. 该函数返回arrayofstrings。
  5. 最终版本看起来应该是(我猜):

    select * from some_table
    left outer join (select * from some_pl_sql_function(id_arg)) sub_query
        on some_table.id_arg = sub_query.id_arg
    

    我应该在子查询中写什么才能使其工作?

1 个答案:

答案 0 :(得分:1)

如果您的arrayofstrings(函数的返回类型)是在架构级别定义的,即 -

create or replace type arrayofstrings as table of varchar2(32767);

然后你可以像这样使用你的功能:

select id_arg, column_value from table(some_pl_sql_function(id_arg))