给个例子可以参考.
create or replace function test return varchar2 as
    v_cursor number;
    v_string varchar2(200);
    v_row number;
begin
    v_cursor:=dbms_sql.open_cursor;
    v_string:='create table testdb (text varchar2(200))';
    dbms_sql.parse(v_cursor,v_string,dbms_sql.native);
    v_row:=dbms_sql.execute(v_cursor);
    dbms_sql.close_cursor(v_cursor);
    return ('成功执行'||v_row||'行!');
    exception
        when others then
            dbms_sql.close_cursor(v_cursor);
            return ('执行失败!'||sqlcode||sqlerrm);
            raise;
end;