An example of the FIRST, LAST and NEXT methods : Table of Number « Collections « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » Collections » Table of Number 
26. 23. 15. An example of the FIRST, LAST and NEXT methods
SQL> DECLARE
  2    TYPE numberTabletype IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
  3    myTable numberTabletype;
  4    idx BINARY_INTEGER;
  5  BEGIN
  6    FOR idx IN 1..10 LOOP
  7      myTable(idx):=(2**idx)+1;
  8    END LOOP;
  9
 10    idx :=myTable.FIRST;
 11
 12    LOOP
 13      dbms_output.put_line(to_char(myTable(idx)));
 14      EXIT WHEN idx =myTable.LAST;
 15      idx :=myTable.NEXT(idx);
 16    END LOOP;
 17  END;
 18  /
3
5
9
17
33
65
129
257
513
1025

PL/SQL procedure successfully completed.
26. 23. Table of Number
26. 23. 1. An example of declaring an Index-by table
26. 23. 2. Initializing a Nested Table
26. 23. 3. NULL and Empty Nested Tables and NULL elements
26. 23. 4. Is a table collection a null value
26. 23. 5. ORA-06531: Reference to uninitialized collection
26. 23. 6. Initialize table collection with null value
26. 23. 7. Accessing an Index-by table
26. 23. 8. Accessing an entire Index-by table
26. 23. 9. Accessing an undefined row of an Index-by table
26. 23. 10. Assigning rows of an Index-By table by means of a LOOP
26. 23. 11. Deleting an Index-by table using an empty Index-by table
26. 23. 12. Using the EXISTS method
26. 23. 13. An example of COUNT method
26. 23. 14. An example of the DELETE method
26. 23. 15. An example of the FIRST, LAST and NEXT methods
26. 23. 16. number_list.EXTEND(2): Add two null value members at the end of the list.
26. 23. 17. number_list.EXTEND(3,4): Add three members at the end of the list and copy the contents of item 4
26. 23. 18. Associative arrays
26. 23. 19. Accessing Nested Table elements
26. 23. 20. ORA-06533: Subscript beyond count
26. 23. 21. compare two tables of integers
26. 23. 22. Loop through table of number by index
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.