Solved

DDl inside PL/SQL

Posted on 2003-10-24
2
1,721 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
ID: 9613009
EXECUTE IMMEDIATE 'ddl statement';

e.g.

EXECUTE IMMEDIATE 'DROP TABLE junk';
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 9615383
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question About Creating Primary Key Constraints on Oracle Tables... 5 45
Oracle Public Synonyms and Privileges 2 65
constraint check 2 40
grant user/role question 11 28
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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 explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

770 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