x

Can one use dynamic SQL within PL/SQL?

Can one use dynamic SQL within PL/SQL? OR Can you use a DDL in a procedure ? How ? Thank you in advance.

more ▼

asked Jan 20 '10 at 02:04 PM in Default

OracleApprender gravatar image

OracleApprender
771 68 73 75

(comments are locked)
10|1200 characters needed characters left

1 answer: sort oldest

You can use dynamic SQL. The EXECUTE command is helpful for this. I supplied an example of that:

Elsewhere on Oracle Overflow

You can't use DDL in a regular stored procedure statement.

However, you can execute DDL with the EXECUTE statement. In fact, Oracle considers "TRUNCATE," which is in my example, to be DDL.

Here's a bit of explanation:

At Oracle-Base

more ▼

answered Jan 21 '10 at 01:39 AM

KillerDBA gravatar image

KillerDBA
1.5k 8 9 10

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x375
x50

asked: Jan 20 '10 at 02:04 PM

Seen: 661 times

Last Updated: Jan 20 '10 at 02:04 PM