Oracle9i Supplied PL/SQL Packages and Types Reference Release 1 (9.0.1) Part Number A89852-02 |
|
DBMS_SQL , 6 of 20
This procedure defines the collection for column into which you want to fetch rows (with a FETCH_ROWS
call). This procedure lets you do batch fetching of rows from a single SELECT
statement. A single fetch call brings over a number of rows into the PL/SQL aggregate object.
When you fetch the rows, they are copied into DBMS_SQL
buffers until you run a COLUMN_VALUE
call, at which time the rows are copied into the table that was passed as an argument to the COLUMN_VALUE
call.
You can declare a local variable as one of the following table-item types, and then fetch any number of rows into it using DBMS_SQL
. (These are the same types as you can specify for the BIND_ARRAY
procedure.)
type Number_Table IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; type Varchar2_Table IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER; type Date_Table IS TABLE OF DATE INDEX BY BINARY_INTEGER; type Blob_Table IS TABLE OF BLOB INDEX BY BINARY_INTEGER; type Clob_Table IS TABLE OF CLOB INDEX BY BINARY_INTEGER; type Bfile_Table IS TABLE OF BFILE INDEX BY BINARY_INTEGER; type Urowid_Table IS TABLE OF UROWID INDEX BY BINARY_INTEGER;
DBMS_SQL.DEFINE_ARRAY ( c IN INTEGER, position IN INTEGER, bf_tab IN Bfile_Table, cnt IN INTEGER, lower_bound IN INTEGER);
pragma restrict_references(define_array,RNDS,WNDS);
The subsequent FETCH_ROWS
call fetch "count" rows. When the COLUMN_VALUE
call is made, these rows are placed in positions indx, indx+1, indx+2, and so on. While there are still rows coming, the user keeps issuing FETCH_ROWS
/COLUMN_VALUE
calls. The rows keep accumulating in the table specified as an argument in the COLUMN_VALUE
call.
Table 62-6 DEFINE_ARRAY Procedure Parameters
The count
has to be an integer greater than zero, otherwise an exception is raised. The indx
can be positive, negative, or zero. A query on which a DEFINE_ARRAY
call was issued cannot contain array binds.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|