Solved

DDl inside PL/SQL

Posted on 2003-10-24
2
1,720 Views
Last Modified: 2006-11-17


can we write DDL statement inside a PL/SQL block how to write a DDL statement inside a PL/SQL block
0
Comment
Question by:nikhilkini
2 Comments
 
LVL 15

Accepted Solution

by:
andrewst earned 50 total points
Comment Utility
EXECUTE IMMEDIATE 'ddl statement';

e.g.

EXECUTE IMMEDIATE 'DROP TABLE junk';
0
 
LVL 34

Expert Comment

by:Mark Geerlings
Comment Utility
Yes, you can use DDL statements in PL\SQL with the "execute immediate" systax as andrewst indicated.  Be aware though of the problems/limitations of DDL in PL\SQL.  If you create a table this way for example, you cannot reference it in your PL\SQL procedure unless you use "execute immediate" each time.  If you drop a table this way, then reference it later in the PL\SQL procedure, it will compile fine, but have a runtime error.  Also, the "execute immediate" syntax works, but is usually slower than standard DML syntax in PL\SQL.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows how to recover a database from a user managed backup
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now