how to alter a tablespace through pl /sql procedure

I want to alter a tablespace through pl/sql procedure ..how???
ashis1278Asked:
Who is Participating?
 
Mark GeerlingsDatabase AdministratorCommented:
Yes, the "execute immediate" command will allow you to execute DDL commands in a PL\SQL procedure.  But are you sure this is the best solution to the problem?  Using PL\SQL to do DDL commands (something that PL\SQL is not designed or optimized to do) is not usually the best option.

What is the business problem that you are trying to solve?
0
 
sdstuberCommented:
create or replace procedure alter_my_tablespace(p_tablespace in varchar2)
is
begin
        execute immediate 'alter tablespace ' || p_tablespace || ' coalesce';
end;

change "coalesce" to whatever command you want
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.