其他

1.在PL/SQL中使用DDL
    
将sql语句赋给一个varchar2变量,在用execute immediate 这个varchar2变量即可;
     示例:
     declare
          str varchar2(200);
     begin
          str:='create table test(id number,name varchar2(20))'; --创建表
          execute immediate str;   
          str:='insert into test values(3,''c'')'; --向表里插数据
          execute immediate str;
     end;    
    
但是要队这个表插入数据也必须使用execute immediate 字符变量

2.判断表是否存在;

     示例:
     declare
          n tab.tname%type;
     begin
          select tname into n from tab where tname='&请输入表名';
          dbms_output.put_line('此表以存在');
     exception
          when no_data_found then
          dbms_output.put_line('还没有此表');
     end;


2.查看以有的过程;

     示例:
     select object_name,object_type,status from user_objects where object_type='PROCEDURE';