DBMS_SQL Package versus Native Dynamic SQL
(Doc ID 93939.1)
Last updated on OCTOBER 04, 2019
Applies to:PL/SQL - Version 126.96.36.199 and later
Information in this document applies to any platform.
***Checked for relevance on 26-Mar-2019***
This articles highlights the advantages of using the DBMS_SQL package and Native Dynamic SQL. Code examples of each method are also provided for illustration, but are not exhaustive.
Beginning with Oracle 8.1.5, two methods are available for implementing dynamic SQL within PL/SQL - DBMS_SQL and Native Dynamic SQL. The DBMS_SQL package is a PL/SQL built-in which offers a programmatic API. Native dynamic SQL (available only in Oracle 8i) enables the placement of dynamic SQL statements directly into PL/SQL code.
Supported statements include DML, DDL, SQL, and PL/SQL anonymous blocks.
In order to implement native dynamic SQL, the COMPATIBLE initialization parameter must be set to 8.1.0 or higher.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document