gpt4 book ai didi

oracle - 连接到 oracle 表值函数

转载 作者:行者123 更新时间:2023-12-02 02:16:41 25 4
gpt4 key购买 nike

是否可以连接到 Oracle 表值函数?

SELECT 
*
FROM
SOME_TABLE a
INNER JOIN
TABLE(GET_TABLE_LIST()) b ON = a.COL_A = b.COL_A

最佳答案

你可以,是的。由于我没有您的 get_TrfrmEngMachineInfoT 函数,因此我将创建自己的集合并将其加入到 SCOTT 架构中的 EMP

SQL> create or replace type typ_person
2 as object (
3 person_id number,
4 person_name varchar2(30)
5 );
6 /

Type created.

SQL> create or replace type tbl_person
2 as table of typ_person;
3 /

Type created.

SQL> ed
Wrote file afiedt.buf

1 create or replace function get_person_list
2 return tbl_person
3 is
4 l_people tbl_person;
5 begin
6 select typ_person( empno, ename )
7 bulk collect into l_people
8 from emp;
9 return l_people;
10* end;
SQL> /

Function created.

SQL> select p.*
2 from emp e
3 join table( get_person_list() ) p on (p.person_id = e.empno);

PERSON_ID PERSON_NAME
---------- ------------------------------
7623 PAV
7369 smith
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 SM0
7902 FORD
7934 MILLER
1234 FOO

16 rows selected.

关于oracle - 连接到 oracle 表值函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6764000/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com