SQL> create global temporary table student(name varchar2(20));表被创建

解决方案 »

  1.   

    EXECUTE IMMEDIATE 'create global temporary table student(name varchar2(20))';
      

  2.   

    --这是动态执行DDL语句的例子,可以参考一下.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;