O'Reilly logo

Oracle and PL/SQL Recipes: A Problem-Solution Approach by Matt Arena, Josh Juneau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8-13. Switching Between DBMS_SQL and Native Dynamic SQL

Problem

Your consulting company is currently migrating all its applications from using DBMS_SQL to native dynamic SQL. To help ensure that the migration can be done piecemeal, you want to provide the ability to switch between the two different techniques so that legacy code can coexist with the newer native dynamic SQL.

Solution

When you need both the DBMS_SQL package and native dynamic SQL, you can switch between them using the DBMS_SQL.TO_REFCURSOR and DBMS_SQL.TO_CURSOR_NUMBER APIs. The DBMS_SQL.TO_REFCURSOR API provides the ability to execute dynamic SQL using the DBMS_SQL package and then convert the DBMS_SQL cursor to a REF CURSOR. The DBMS_SQL.TO_CURSOR_NUMBER API allows for executing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required