rowtype.iterations : ROWTYPE « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> create table job_parameters
  2  ( jobid number primary key,
  3    iterations number,
  4    table_idx number );

Table created.

SQL>
SQL>
SQL> create or replace procedure bind( p_job in number )
  2  as
  3      l_rec job_parameters%rowtype;
  4  begin
  5      select * into l_rec from job_parameters where jobid = p_job;
  6      for i in 1 .. l_rec.iterations
  7      loop
  8          execute immediate
  9          'insert into t' || l_rec.table_idx || ' values ( :x )' using i;
 10          commit;
 11      end loop;
 12      delete from job_parameters where jobid = p_job;
 13  end;
 14  /

Procedure created.

SQL> drop table job_parameters;

Table dropped.

SQL>
SQL>








21.27.ROWTYPE
21.27.1.Declare ROWTYPE variable
21.27.2.Reference attribute in a ROWTYPE variable
21.27.3.Select value into the %ROWTYPE type variable
21.27.4.Using a Weak REF CURSOR and %ROWTYPE
21.27.5.Defining and using a cursor-oriented record
21.27.6.INSERT statement involving entire records
21.27.7.UPDATE statement involving entire records
21.27.8.Use rowtype with object table
21.27.9.rowtype.iterations
21.27.10.Use table column type as the record attribute type
21.27.11.Select * into table%rowtype
21.27.12.PLS-00382: expression is of wrong type