This script demonstrates how to do a non-bulk select into elements of a PL/SQL table. : Select Into « PL SQL « Oracle PL / SQL






This script demonstrates how to do a non-bulk select into elements of a PL/SQL table.

    
SQL> CREATE TABLE myTable
  2   (id                INTEGER              NOT NULL
  3   ,CONSTRAINT id_pk  PRIMARY KEY (id));

Table created.

SQL>
SQL>
SQL>
SQL>
SQL>
SQL> DECLARE
  2
  3     
  4     TYPE number_table IS TABLE OF myTable.id%TYPE INDEX BY BINARY_INTEGER;
  5
  6     
  7     number_list NUMBER_TABLE;
  8
  9   BEGIN
 10
 11     
 12     FOR i IN 1..10000 LOOP
 13       INSERT INTO myTable VALUES  (i);
 14      END LOOP;
 15
 16   END;
 17   /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>
SQL>
SQL>

   
    
    
    
  








Related examples in the same category

1.Select value from table into variable
2.Oracle returns an error when a SELECT statement returns more than one row
3.Catch too_many_rows Exception for 'Select into' statement
4.Multiple-Row SELECT Command with Several Exception-Handling Routines
5.Select count result into a variable
6.Output variable after 'select into'
7.SELECT into value pair
8.Select the number of employees into the l_emp_count variable
9.Select into and subquery
10.Select single value into variable
11.Select two columns into a cursor variable
12.Select value into a number variable in a for loop
13.Select value to variable one by one
14.If no records are retrieved for a SELECT - INTO statement the following error is returned
15.If too many records are returned for a SELECT - INTO statement the following error is returned
16.no_data_found from select ... into
17.select bulk collect into table collection
18.Use subquery in pl/sql block
19.TOO_MANY_ROWS exception and select into command
20.Store max(salary) to a variable
21.Store max(tableName.column) to tableName.column.type variable
22.Bulk Collection: fetch a single row from the ALL_OBJECTS table.
23.Calculate salary by adding salary with max(salary)
24.Select data for update
25.Select value from aggregate function to variable