Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Oracle数据库12c中返回多个值_Oracle_Function_Oracle12c - Fatal编程技术网

如何在Oracle数据库12c中返回多个值

如何在Oracle数据库12c中返回多个值,oracle,function,oracle12c,Oracle,Function,Oracle12c,我知道这个问题是在 或 我按照他们,但它是造成错误的,我不能编译它。我遗漏了一些东西,所以我需要帮助 我的代码是 create or replace type child_type AS OBJECT ( child_id_number varchar2(2000), child_name varchar2(2000), other_id varchar2(2000) ); CREATE or replace function children_b

我知道这个问题是在

我按照他们,但它是造成错误的,我不能编译它。我遗漏了一些东西,所以我需要帮助

我的代码是

create or replace type child_type AS OBJECT
(
  child_id_number varchar2(2000),
  child_name varchar2(2000),
  other_id varchar2(2000)
);


        CREATE or replace function children_b
        (
                   i_id_number IN VARCHAR2
        )
        RETURN child_type
        AS

child_record child_type;



    BEGIN

                  SELECT LISTAGG(ch.child_id_number, ', ')WITHIN GROUP (ORDER BY ch.child_id_number),
                         LISTAGG(e.mail_name, ', ')WITHIN GROUP (ORDER BY e.mail_name),
                         LISTAGG(ib.other_id,', ')WITHIN GROUP (ORDER BY ib.other_id)

    INTO child_type.child_id_number,child_type.child_name,child_type.other_id

                         FROM entity e
                         JOIN children ch ON ch.child_id_number = e.id_number
                         JOIN ids_base ib ON ib.id_number = ch.child_id_number
                         WHERE ib.ids_type_code = 'BAN'
                         AND ch.id_number IN (i_id_number)
                         GROUP BY ch.id_number;


        return(child_record);



        End children_b;
错误消息是函数TU_ADIS.TU_CHILDREN_B的编译错误

错误:PLS-00330:类型名称或子类型名称的使用无效 第23行 文本:分为子类型。子标识号,子类型。子名称,子类型。其他标识

错误:PL/SQL:ORA-00904::标识符无效 第24行 文本:来自bio_实体e

错误:PL/SQL:SQL语句被忽略 电话号码:20 文本:选择组内的LISTAGG(ch.child\u id\u编号,,')(按ch.child\u id\u编号排序)


非常感谢。

在您的INTO子句中更改

child_type.child_id_number,child_type.child_name,child_type.other_id 

您正在检索对象的实例,而不是对象本身。
我刚刚创建了你的函数,这对我很有用

您的INTO子句根据变量的类型而不是名称引用变量,
child\u record
。谢谢!!!!!!!!!它现在正在工作!!!非常感谢你!!!!!现在,当我运行函数时,我发现这个错误ORA-06530引用未初始化。您不知道它是什么?不确定您是如何运行它的,但是函数返回的对象实例需要返回到某个对象中,并且某个对象需要初始化。
child_record.child_id_number,child_record.child_name,child_record.other_id