Home » SQL & PL/SQL » SQL & PL/SQL » indexed variables in PL/SQL eg. i1,i2,i3
indexed variables in PL/SQL eg. i1,i2,i3 [message #4018] Sun, 03 November 2002 05:36 Go to next message
Güray
Messages: 6
Registered: November 2002
Junior Member
hello,
i am very new in PL/SQL.
i want to describe indexed variables eg. x1,x2,x3,
k(i,j) etc.
how can i do this ?
thanks..
Re: indexed variables in PL/SQL eg. i1,i2,i3 [message #4021 is a reply to message #4018] Sun, 03 November 2002 16:08 Go to previous message
N
Messages: 26
Registered: April 2002
Junior Member

PL/SQL Tables

Like an array, a PL/SQL table is an ordered collection of elements of the same type. Each element has a unique index number that determines its position in the ordered collection. But, unlike an array, a PL/SQL table is unbounded. So, its size can increase dynamically. Also, it does not require consecutive index numbers. So, it can be indexed by any series of integers. 
PL/SQL tables help you move bulk data. They can store columns or rows of Oracle data, and they can be passed as parameters. So, PL/SQL tables make it easy to move collections of data into and out of database tables or between client-side applications and stored subprograms. 

You can use a cursor FOR loop to fetch an entire column or table of Oracle data into a PL/SQL table. In the following example, you fetch a table of data into the PL/SQL table dept_tab:

DECLARE
   TYPE DeptTabTyp IS TABLE OF dept%ROWTYPE
      INDEX BY BINARY_INTEGER;
   dept_tab DeptTabTyp;
   n BINARY_INTEGER := 0;
BEGIN
   FOR dept_rec IN (SELECT * FROM dept) LOOP
      n := n + 1;
      dept_tab(n) := dept_rec;
   END LOOP;
   ...
END;

Previous Topic: errors in pl/sql function
Next Topic: Function Problem
Goto Forum:
  


Current Time: Sun Apr 28 19:44:57 CDT 2024