Oracle Magazine, Nov/Dec 2017
Database Developer PL SQL If you are fetching more than one row with SELECT INTO you must use BULK COLLECT to populate an array ORACLE MAGAZINE NOVEMBER DECEMBER 2017 64 BEGIN SELECT t my_ column BULK COLLECT INTO my_ array FROM my_ table t WHERE multi_ row_ condition END And it is much the same with EXECUTE IMMEDIATE Note that in the following dynamic SQL code samples I will use strings that are not in fact dynamic in order to keep the code as simple as possible Please heed my earlier dynamic SQL advice which includes avoiding unnecessary usage of dynamic SQL studying SQL injection reducing attack surfaces binding values never trusting text entered by a user using DBMS_ ASSERT and so on Also note that sample code for this article is available on Oracles Live SQL website Here is a sample block that uses EXECUTE IMMEDIATE with SELECT INTO and BULK COLLECT DECLARE TYPE name_ salary_ rt IS RECORD name VARCHAR2 1000 salary NUMBER 1 2 3 4 5 6
You must have JavaScript enabled to view digital editions.