Using the collection methods, PL-SQL Programming

Using the Collection Methods

The collection methods below help to generalize the code and make collections easier to use and also make your applications easier to maintain:

EXISTS

COUNT

LIMIT

FIRST and LAST

PRIOR and NEXT

EXTEND

TRIM

DELETE

A collection method is a built-in function or the process that operates on collections and is called using the dot notation. The syntax is as shown below:

collection_name.method_name[(parameters)]

The Collection methods can be called from the procedural statements but not from the SQL statements. The COUNT, EXISTS, LIMIT, FIRST, PRIOR, LAST, & NEXT are the functions, that appear as a part of an expression. And EXTEND, DELETE, and TRIM are the procedures that appear as a statement. Also, the EXISTS, TRIM, PRIOR, NEXT, EXTEND, and DELETE take parameters. Each parameter should be an integer expression. Only the EXISTS can be applied to automatically null collections. Whenever you apply another method to such type of collections, then the PL/SQL raises COLLECTION_IS_NULL.

Posted Date: 10/4/2012 3:12:26 AM | Location : United States







Related Discussions:- Using the collection methods, Assignment Help, Ask Question on Using the collection methods, Get Answer, Expert's Help, Using the collection methods Discussions

Write discussion on Using the collection methods
Your posts are moderated
Related Questions
NULL Statement The NULL statement clearly specifies in action; it does nothing other than to pass control to the next statement. It can, though, improve the readability. In a

Committing and Rolling Back The COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. As the figure shows, if one transaction ends,

Passing Cursor Parameters You use the OPEN statement to pass the parameters to a cursor. Unless you want to accept the default values, each proper parameter in the cursor decl

Using %TYPE The %TYPE attribute gives the datatype of a variable or the database column. In the example below, the %TYPE gives the datatype of a variable: credit REAL(7,2); debi

Operators on Tables and Rows Row Extraction TUPLE FROM r, SQL has row subqueries. These are just like scalar subqueries except that they may specify more than one column.

Ensuring Backward Compatibility   The PL/SQL Version 2 permits some abnormal behavior which Version 8 disallows. Particularly, Version 2 permits you to (i) Make the forw

Inserting Objects: You can use the INSERT statement to add objects to an object table. In the illustration below, you insert a Person object into the object table persons:

Referencing Records Unlike the elements in a collection, that are accessed using subscripts, the fields in a record are accessed by name. To reference an individual field, you

SQL Cursor   The Oracle implicitly opens a cursor to process each SQL statement not related with an explicit cursor. The PL/SQL refers to the most current implicit cursor as t

Parameter and Keyword Description: cursor_name: This identifies an explicit cursor formerly declared within the present scope. cursor_variable_name: These identif