Navigation

  • index
  • next |
  • previous |
  • Database Compatibility Stored Procedural Language Guide 13 documentation »
  • Collection Methods »

NEXTΒΆ

NEXT is a method that returns the subscript that follows a specified subscript. The method takes a single argument; the subscript that you are testing for.

<collection>.NEXT(<subscript>)

collection is the name of the collection.

If the specified subscript is less than the first subscript in the collection, the function returns the first subscript. If the subscript does not have a successor, NEXT returns NULL. If you specify a NULL subscript, PRIOR does not return a value.

The following example demonstrates using NEXT to return the subscript that follows subscript 10 in the associative array, sparse_arr:

DECLARE
    TYPE sparse_arr_typ IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    sparse_arr      sparse_arr_typ;
BEGIN
    sparse_arr(-100)  := -100;
    sparse_arr(-10)   := -10;
    sparse_arr(0)     := 0;
    sparse_arr(10)    := 10;
    sparse_arr(100)   := 100;
    DBMS_OUTPUT.PUT_LINE('NEXT element: ' || sparse_arr.next(10));
END;

NEXT element: 100

Logo

Previous topic

LIMIT

Next topic

PRIOR

Quick search

Table of Contents

  • Basic SPL Elements
  • SPL Programs
  • Variable Declarations
  • Basic Statements
  • Control Structures
  • Transaction Control
  • Dynamic SQL
  • Static Cursors
  • REF CURSORs and Cursor Variables
  • Collections
  • Collection Methods
    • COUNT
    • DELETE
    • EXISTS
    • EXTEND
    • FIRST
    • LAST
    • LIMIT
    • NEXT
    • PRIOR
    • TRIM
  • Working with Collections
  • Triggers
  • Packages
  • Object Types and Objects
  • Errors and Messages
  • Conclusion

Navigation

  • index
  • next |
  • previous |
  • Database Compatibility Stored Procedural Language Guide 13 documentation »
  • Collection Methods »
  • index
  • next |
  • previous |