Last active
August 29, 2015 14:00
-
-
Save velll/11374606 to your computer and use it in GitHub Desktop.
BULK COLLECT initializes collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Bulk collect leaves collection NOT NULL when no rows got | |
| DECLARE | |
| nt NUMBER_TABLE; -- does not change if you initialize it like ':= NUMBER_TABLE()' | |
| BEGIN | |
| SELECT 1 | |
| BULK COLLECT INTO nt | |
| FROM DUAL | |
| WHERE 1 = 2; | |
| IF nt IS NULL THEN | |
| RAISE_APPLICATION_ERROR(-20100, 'nt is null'); | |
| ELSE | |
| RAISE_APPLICATION_ERROR(-20100, 'nt is not null: ' || nt.COUNT || ' rows'); | |
| END IF; | |
| END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment