Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

DDl inside PL/SQL

Posted on 2003-10-24
2
1,722 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to connect SQL Server from my Oracle database? 11 131
how to trim oracle sql sentence in unix 17 58
Database Design Dilemma 6 58
Checking for column width 8 28
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

839 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