Oracle Magazine, Nov/Dec 2017
Database Developer PL SQL ORACLE MAGAZINE NOVEMBER DECEMBER 2017 67 FROM hr employees WHERE salary min_ salary_ in END IF RETURN l_ cursor END I take advantage of OPEN FOR in this case to simply allow myself to use conditional logic at runtime to determine which static SELECT statement should be associated with the cursor variable I can then pass this variable back to the calling program which is often not a PL SQL program such as a Java method But OPEN FOR is most commonly used with dynamically constructed queries Lets see how I can use OPEN FOR this way by rewriting the previous PL SQL block that used EXECUTE IMMEDIATE DECLARE TYPE name_ salary_ rt IS RECORD name VARCHAR2 1000 salary NUMBER TYPE name_ salary_ aat IS TABLE OF name_ salary_ rt INDEX BY PLS_ INTEGER l_ employees name_ salary_ aat 1 2 3 4 5 6 7 8 9 10 11
You must have JavaScript enabled to view digital editions.