Solved

DDl inside PL/SQL

Posted on 2003-10-24
2
1,723 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
[X]
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
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use of Exception to end a Loop 3 54
Oracle DB monitor SW 21 72
any step by steps guide on how to install Oracle 12c on Windows 10 8 104
pl/sql parameter is null sometimes 2 23
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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

763 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