-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmagic.sql
More file actions
43 lines (37 loc) · 861 Bytes
/
magic.sql
File metadata and controls
43 lines (37 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/** PACKAGE ptype
IS
TYPE tarray_n IS TABLE OF NUMBER; --1
TYPE refcur IS REF CURSOR; --2
END;
**/
Example :
FUNCTION f_create ( ) RETURN VARCHAR2
..
v_tables ptype.tarray;
type type_rec is record(row NUMBER ...);
v_rec type_rec;
v_counter binary_integer := 1;
v_cc ptype.refcur;
...
BEGIN
...
---------------------------------------------------------------
/**SELECT obj BULK COLLECT INTO v_tables ; *//
--This !!!
v_cc := '***' --вызов функции возвращающей refcur
LOOP
FETCH v_cc INTO v_rec;
EXIT WHEN v_cc%NOTFOUND;
SELECT v_rec.obj
INTO v_tables(v_counter)
FROM dual;
v_counter := v_counter + 1;
END LOOP;
CLOSE v_cc ;
FOR i IN v_tables.FIRST .. v_tables.LAST
LOOP
...
END LOOP;
---------------------------------------------------------------
...
END;