Q

Way to create table using procedure

Is there an alternate way to create a table using a procedure?

Is there an alternate way to create a table using a procedure?
You can use the EXECUTE IMMEDIATE command in your stored procedure to run DDL to create a table, similar to the following:
CREATE PROCEDURE my_proc AS
BEGIN
   EXECUTE IMMEDIATE 'CREATE TABLE foo (bar NUMER)';
END;
/
However, it is almost always poor design to run DDL inside a stored procedure. Typically, we do no let our users create tables on the fly by running a stored proc in their application code.
This was first published in May 2006

Dig deeper on Oracle database backup and recovery

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close