PL/SQL - Collections
PL/SQL telah menyediakan teknik pengumpulan data sbb:
No | Method Name & Purpose |
---|---|
1 |
EXISTS(n)
Returns TRUE if the nth element in a collection exists; otherwise returns FALSE.
SELECT *
FROM data_karyawan
WHERE EXISTS (SELECT * FROM jabatan_karyawan WHERE jab_id = jab_kar);
|
2 |
COUNT
Returns the number of elements that a collection currently contains.
select count(*) from data_karyawan;
|
3 |
LIMIT
Checks the maximum size of a collection.
SELECT * FROM data_karyawan
ORDER BY nama
OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY; -->ini hanya db 12 ke atas, kalau untuk versi 12 kebawah gunakan sub query.
|
4 |
FIRST
Returns the first (smallest) index numbers in a collection that uses the integer subscripts.
|
5 |
LAST
Returns the last (largest) index numbers in a collection that uses the integer subscripts.
|
6 |
PRIOR(n)
Returns the index number that precedes index n in a collection.
|
7 |
NEXT(n)
Returns the index number that succeeds index n.
|
8 |
EXTEND
Appends one null element to a collection.
|
9 |
EXTEND(n)
Appends n null elements to a collection.
|
10 |
EXTEND(n,i)
Appends n copies of the ith element to a collection.
|
11 |
TRIM
Removes one element from the end of a collection.
|
12 |
TRIM(n)
Removes n elements from the end of a collection.
|
13 |
DELETE
Removes all elements from a collection, setting COUNT to 0.
|
14 |
DELETE(n)
Removes the nth element from an associative array with a numeric key or a nested table. If the associative array has a string key, the element corresponding to the key value is deleted. If n is null, DELETE(n) does nothing.
|
15 |
DELETE(m,n)
Removes all elements in the range m..n from an associative array or nested table. If m is larger than n or if m or n is null, DELETE(m,n) does nothing.
|