Solved

DDl inside PL/SQL

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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.
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…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

622 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