My Oracle Support Banner

DBMS_SQL Package versus Native Dynamic SQL (Doc ID 93939.1)

Last updated on JANUARY 30, 2022

Applies to:

PL/SQL - Version 8.1.5.0 and later
Information in this document applies to any platform.

Purpose

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.

Scope

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.

Details

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
Purpose
Scope
Details

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.