In fact, the memory table is a bit like an array in Java, but it has a much stronger place than the array.
1. Let's start with a brief introduction to the memory table:
2. How do I use the memory table type?
Defining Memory Table Types
TYPE type_nameis TABLE of Storage type (number,Employees.last_name%type, Employees%rowtype, VARCHAR2)
INDEX by (BINARY_INTEGER,VARCHAR2 (80).)
---varchar2 (80) indicates that the subscript can be accessed through a string, which is more powerful than the array in Java
Declare the type variable
Identifier Type_name
3. Some properties and methods in the memory table
Assignment value:
Identifier (1): = ' Jams '-this is index by Binary_integer
Identifier (' A '): = ' Jams '-this is index by VARCHAR2
The difference between an array in Java and a memory table can use a string as a subscript
Count Method:
Identifier.count--Returns the number of rows in the memory table
Exists method:
Identifier.exists (1)--determining that an element with subscript 1 does not exist
First and Last properties:
First: returns the index of row one
Last: Returns the index of the final row
First and last usage: Generally used in the case of traversing memory tables For I in Identifier.first. Identifier.last loop ... end loop, .... Here are two points to note: 1. If there is no data in the memory table, but you traverse it in this way, you will get an error, so you should use it before traversing. Count method to make a judgment 2. What if the data in the memory table is not continuously labeled? For example, the memory table is only identifier (2), identifier (5), When traversing to subscript for 1,3,4, to do an exception or error handling, or will error.
This is accompanied by the role of index by Binary_integer
--http://blog.itpub.net/26690043/viewspace-722081/
|
This article is from the "11768293" blog, please be sure to keep this source http://11778293.blog.51cto.com/11768293/1792626
Memory table--index by table in Plsql