v_str:='select count(*) from '||v_tab_name;
execute immediate v_str into|n_count;

解决方案 »

  1.   

    v_str:='select count(*) from '||v_tab_name;
    execute immediate v_str into n_count
      

  2.   

    v_tab_name varchar2(100) :='sales';          <--这里加上类型
        v_count number;
        v_str varchar2(500);
    begin     
        v_str:='select count(*) ' from '||v_tab_name;    execute immediate v_str into v_count;     <--这里加上    dbms_output.put_line(v_count);end;
      

  3.   

    declare    
    v_tab_name varchar2(200);
    begin
    v_tab_name :='sales';
    v_str:='select count(*) from '||v_tab_name;
    execute immediate v_str into v_count ;
    dbms_output.put_line(v_count);
    end;
      

  4.   

    还有错begin     
        v_str:='select count(*) ' from '||v_tab_name;    execute immediate v_str into v_count;     <--这里加上    dbms_output.put_line(v_count);end;ORA-06564: 对象 DATA_FILE_DIR 不存在
    ORA-06512: 在line 31
      

  5.   

    那就不是刚才的错误了
    现在的好像是一个目录不错在
    你用UTL_FILE读写文件啊?
      

  6.   

    全发给您,看一下:
    declare
         v_tab_name varchar2(100);
         v_str varchar2(100);
         b_if_rec  number;
         
         cursor c_emp is select * from all_all_tables where owner='SH';
     
         type dept_array is varray(100) of all_all_tables%rowtype;
         depts dept_array;
     iggg1 number;
     iggg2 number;
     n_count number;
    begin
         iggg1 :=0;
         depts:=dept_array();
         
         for emp in c_emp loop
         iggg1:=iggg1+1;
         depts.extend();
         depts(iggg1).table_name:=emp.table_name;
         end loop;for iggg2 in 1..iggg1 loop    v_tab_name :=depts(iggg2).table_name;v_str:='select count(*)  from sh.'||v_tab_name;
     /*   v_str:='select count(*) from SH.'||v_tab_name;*/
        dbms_output.put_line(v_str);
        execute immediate v_str into n_count;
        
        dbms_output.put_line(n_count);
    end loop;
         
    end;
    ORA-06564: 对象 DATA_FILE_DIR 不存在
    ORA-06512: 在line 31