Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Oracle [игнор отключен] [закрыт для гостей] / 12c select .. from table ( package collection) / 10 сообщений из 10, страница 1 из 1
30.09.2014, 17:54
    #38762448
12с
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
Господа, подскажите пожалуйста ссылку на документацию.
Не могу найти, где описана table function для PLSQL - select * from table (collection).
А то я вижу что есть в 12-ке возможность использовать nested table объявленный в пакете, а не как раньше object - type на уровне базы, но в упор не могу найти это в документации.
Или я путаю что-то и всегда можно было выбирать в пакете из пакетной же коллекции оператором table?
...
Рейтинг: 0 / 0
30.09.2014, 18:12
    #38762474
12c select .. from table ( package collection)
12сИли я путаю что-то и всегда можно было выбирать в пакете из пакетной же коллекции оператором table?
Можно было.
Но не всегда.
И при этом все равно неявно создается тип.
...
Рейтинг: 0 / 0
30.09.2014, 18:12
    #38762475
-2-
-2-
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
New Features Guide 2.1.4.12 PL/SQL-Specific Data Types Allowed Across the PL/SQL-to-SQL Interface

Through Oracle Database 11g Release 2 (11.2), when PL/SQL invoked SQL, only values with data types supported by SQL could be bound. This restriction applied even when the called SQL was a PL/SQL anonymous block. This restriction is removed in Oracle Database 12c Release 1 (12.1). For example, a PL/SQL subprogram with a formal parameter whose data type is BOOLEAN can now be invoked dynamically using an anonymous block.

Other restrictions are also removed. The table operator can now be used in a PL/SQL program on a collection whose data type is declared in PL/SQL. This also allows the data type to be a PL/SQL associative array. (In prior releases, the collection's data type had to be declared at the schema level.)

The removal of these restrictions increases the power of expression and the usefulness of PL/SQL. In particular, the extended flexibility of the table operator allows code written to run other vendors' stored procedure languages to be easily migrated to PL/SQL.
...
Рейтинг: 0 / 0
30.09.2014, 18:19
    #38762484
stax..
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
уувуукукуку12сИли я путаю что-то и всегда можно было выбирать в пакете из пакетной же коллекции оператором table?
Можно было.
Но не всегда.
И при этом все равно неявно создается тип.
в 12-ке не создается?

.....
stax
...
Рейтинг: 0 / 0
30.09.2014, 18:23
    #38762489
12c select .. from table ( package collection)
stax..уувуукукукупропущено...

Можно было.
Но не всегда.
И при этом все равно неявно создается тип.
в 12-ке не создается?

.....
stax
Наверное создается или может какой механизм обходной придумали )
С 12 не встречался.
...
Рейтинг: 0 / 0
30.09.2014, 18:24
    #38762491
12c
12c
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
-2-,

Точно, спасибо большое, читал как-то new featches и пропустил. А сейчас по поиску не смог найти . Плохо значит искал.
...
Рейтинг: 0 / 0
30.09.2014, 19:03
    #38762539
stax..
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
-2-New Features Guide 2.1.4.12 PL/SQL-Specific Data Types Allowed Across the PL/SQL-to-SQL Interface

Through Oracle Database 11g Release 2 (11.2), when PL/SQL invoked SQL, only values with data types supported by SQL could be bound. This restriction applied even when the called SQL was a PL/SQL anonymous block. This restriction is removed in Oracle Database 12c Release 1 (12.1). For example, a PL/SQL subprogram with a formal parameter whose data type is BOOLEAN can now be invoked dynamically using an anonymous block.

Other restrictions are also removed. The table operator can now be used in a PL/SQL program on a collection whose data type is declared in PL/SQL. This also allows the data type to be a PL/SQL associative array. (In prior releases, the collection's data type had to be declared at the schema level.)

The removal of these restrictions increases the power of expression and the usefulness of PL/SQL. In particular, the extended flexibility of the table operator allows code written to run other vendors' stored procedure languages to be easily migrated to PL/SQL.
в 12-ке отработает?
Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
declare
 type stax_NUM_TABLE IS TABLE OF NUMBER;
 tt stax_NUM_TABLE :=stax_NUM_TABLE(1.2);
-- ta ANE_NUM_TABLE :=ANE_NUM_TABLE(1,2);
begin
 for r in (select * from table(tt) ) loop
  dbms_output.put_line(r.column_value);
 end loop;
end;
/


......
stax
...
Рейтинг: 0 / 0
30.09.2014, 19:28
    #38762572
ora601
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
12c-2-,

Точно, спасибо большое, читал как-то new featches и пропустил. А сейчас по поиску не смог найти . Плохо значит искал.

new fetches maybe ? :)
...
Рейтинг: 0 / 0
01.10.2014, 08:26
    #38762825
Elic
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
stax..в 12-ке отработает?
Код: plsql
1.
declare

RTFM More PL/SQL-Only Data Types Can Cross PL/SQL-to-SQL Interface (FAQ) :The PL/SQL-only data type must be either predefined (like BOOLEAN in Example 7-2) or declared in a package specification (like the record in Example 7-3).
...
Рейтинг: 0 / 0
Период между сообщениями больше года.
10.01.2017, 11:01
    #39381277
arlx
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
12c select .. from table ( package collection)
а так отработает.
Код: plsql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
create or replace package p_test is
  type t_num is table of t_table%rowtype;
  function fn_nsttbl return number;
end p_test;
/
create or replace package body p_test is

  function fn_nsttbl return number is
    l t_num;
    i number;
  begin
    select * bulk collect into l from t_table;
    select count(1) into i from table(l);
    dbms_output.put_line(i);
    return i;
  end;
end p_test;
/
select p_test.fn_nsttbl from dual;
...
Рейтинг: 0 / 0
Форумы / Oracle [игнор отключен] [закрыт для гостей] / 12c select .. from table ( package collection) / 10 сообщений из 10, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]