Putting Methods to
Work in Oracle8
Oracle Tips by Mike Ault
Use of Other
Built-in Methods for Collections
Another example would be for a VARRAY where we
want to only process the number of values that are in each VARRAY
instance set. To do this we can use
FIRST and LAST or, one (1) and COUNT.
FOR j IN addresses.FIRST..addresses.LAST LOOP
-- or ń
FOR j in 1..addresses.COUNT LOOP
The last example shows how to determine if a
specific number of instances can be added to a VARRAY using the
LIMIT collection method.
IF (addresses.COUNT +
5) < addresses.LIMIT THEN
-- add 5 more addresses
Again, let us stress, as is shown in these code
fragments, the collection methods can only be used in procedural
statements and not in DML.
SEE CODE DEPOT FOR FULL SCRIPTS
For more information on this topic, I recommend Don
Burleson's latest book "Oracle
Tuning: The Definitive Reference".
You can buy it direct from the publisher for 50%-off and get
instant access to the code depot of Oracle tuning scripts:
Expert Remote DBA
BC is America's oldest and largest Remote DBA Oracle support
provider. Get real Remote DBA experts, call
BC Remote DBA today.