1. <legend id='u1Cic'><style id='u1Cic'><dir id='u1Cic'><q id='u1Cic'></q></dir></style></legend>

        <bdo id='u1Cic'></bdo><ul id='u1Cic'></ul>

      <i id='u1Cic'><tr id='u1Cic'><dt id='u1Cic'><q id='u1Cic'><span id='u1Cic'><b id='u1Cic'><form id='u1Cic'><ins id='u1Cic'></ins><ul id='u1Cic'></ul><sub id='u1Cic'></sub></form><legend id='u1Cic'></legend><bdo id='u1Cic'><pre id='u1Cic'><center id='u1Cic'></center></pre></bdo></b><th id='u1Cic'></th></span></q></dt></tr></i><div id='u1Cic'><tfoot id='u1Cic'></tfoot><dl id='u1Cic'><fieldset id='u1Cic'></fieldset></dl></div>

      <small id='u1Cic'></small><noframes id='u1Cic'>

    2. <tfoot id='u1Cic'></tfoot>
    3. SQL 语句中不允许使用本地集合类型

      local collection types not allowed in SQL statements(SQL 语句中不允许使用本地集合类型)

        <i id='Y38jP'><tr id='Y38jP'><dt id='Y38jP'><q id='Y38jP'><span id='Y38jP'><b id='Y38jP'><form id='Y38jP'><ins id='Y38jP'></ins><ul id='Y38jP'></ul><sub id='Y38jP'></sub></form><legend id='Y38jP'></legend><bdo id='Y38jP'><pre id='Y38jP'><center id='Y38jP'></center></pre></bdo></b><th id='Y38jP'></th></span></q></dt></tr></i><div id='Y38jP'><tfoot id='Y38jP'></tfoot><dl id='Y38jP'><fieldset id='Y38jP'></fieldset></dl></div>

          <bdo id='Y38jP'></bdo><ul id='Y38jP'></ul>
              <legend id='Y38jP'><style id='Y38jP'><dir id='Y38jP'><q id='Y38jP'></q></dir></style></legend>

              <small id='Y38jP'></small><noframes id='Y38jP'>

                  <tbody id='Y38jP'></tbody>
                <tfoot id='Y38jP'></tfoot>
                本文介绍了SQL 语句中不允许使用本地集合类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个关于在 Oracle SQL 函数中使用集合的问题.

                I have a question regarding using of collections in Oracle SQL functions.

                包中有类型定义:

                /* Types of package*/
                create or replace PACKAGE "test" AS 
                
                TYPE type_record_1 IS record ( id_num NUMBER , timestamp_num NUMBER,value NUMBER);
                TYPE type_table_1 IS TABLE OF type_record_1; 
                TYPE type_record_2 IS record ( id_num NUMBER , timestamp_num NUMBER,pValue NUMBER);
                TYPE type_table_2 IS TABLE OF type_record_2; 
                END test;
                

                问题出在函数_2.function_2 使用 function_1 的输出.当我尝试在 function_2 中选择时出现错误消息.错误消息SQL 语句中不允许使用本地集合类型".

                Problem is in functions_2. function_2 uses output from function_1. The error message occurs when I try select in function_2. Error message "local collection types not allowed in SQL statements".

                你能帮忙吗?在函数中使用集合有什么问题?

                Could you please help? What is wrong with using of collections in functions?

                /*function 1*/
                FUNCTION function_1
                RETURN  type_table_1
                IS
                table_1 type_table_1;
                BEGIN
                -- select values from
                SELECT id_num, timestamp_num, value --type_record_1 (id_num, timestamp_num, value) 
                BULK COLLECT INTO table_1 
                    FROM (
                      SELECT       
                        l.id_num,
                        EXTRACT(hour from end_time) * 60 + EXTRACT(minute from end_time) as timestamp_num,
                        l.value
                      FROM INTERVAL_F l
                      WHERE id_num IN (SELECT id_num FROM table_rev)
                    );
                
                 RETURN table_1;
                
                 END function_1;
                
                
                 /*function 2*/
                 FUNCTION function_2
                         (
                          table_1 IN type_table_1
                          )
                 RETURN type_table_2
                 IS 
                 table_2 type_table_2;
                 BEGIN
                
                 SELECT type_record_2(id_num , timestamp_num , pValue)
                 BULK COLLECT INTO table_2 FROM (
                 SELECT  id_num
                       , timestamp_num 
                       , value as pValue
                       FROM table(table_1)  -- ERROR IS HERE
                       );
                
                 RETURN table_2;
                 END function_2;
                

                推荐答案

                为了达到这个目的,你应该使用类似的东西:

                To achive that you should use something like:

                创建或替换类型 type_record_1.../

                CREATE OR REPLACE TYPE type_record_1... /

                创建或替换类型 type_table_1 作为 type_record_1 的表;/

                CREATE OR REPLACE TYPE type_table_1 AS TABLE OF type_record_1; /

                Oracle 不允许将包中声明的类型转换为表.一直到 11 才谈 Oracle,还没查 12c 的新特性 :(.

                Oracle does not allow types declared in package to be casted as table. I talk about Oracle until 11, still not check 12c new features :(.

                这篇关于SQL 语句中不允许使用本地集合类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                SQL query to group by day(按天分组的 SQL 查询)
                What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                  <tbody id='uA62r'></tbody>
                  <bdo id='uA62r'></bdo><ul id='uA62r'></ul>
                  <legend id='uA62r'><style id='uA62r'><dir id='uA62r'><q id='uA62r'></q></dir></style></legend>
                  • <tfoot id='uA62r'></tfoot>
                      <i id='uA62r'><tr id='uA62r'><dt id='uA62r'><q id='uA62r'><span id='uA62r'><b id='uA62r'><form id='uA62r'><ins id='uA62r'></ins><ul id='uA62r'></ul><sub id='uA62r'></sub></form><legend id='uA62r'></legend><bdo id='uA62r'><pre id='uA62r'><center id='uA62r'></center></pre></bdo></b><th id='uA62r'></th></span></q></dt></tr></i><div id='uA62r'><tfoot id='uA62r'></tfoot><dl id='uA62r'><fieldset id='uA62r'></fieldset></dl></div>
                    • <small id='uA62r'></small><noframes id='uA62r'>