Listing 4: Granting Privileges in a Procedure

create or replace procedure coalesce_tablespace( p_tablespace in varchar2 )
is
    cursor_name     pls_integer default dbms_sql.open_cursor;
    ignore          pls_integer;
BEGIN

    dbms_sql.parse(cursor_name, 
                   'alter tablespace ' || p_tablespace || ' coalesce',
                    dbms_sql.native);
    ignore := dbms_sql.execute(cursor_name);
    dbms_sql.close_cursor(cursor_name);
END;