问答题 查找出当前用户模式下,每张表的记录数,以scott用户为例,结果应如下: DEPT...........................4 EMP...........................14 BONUS..........................0 SALGRADE.........................5
【正确答案】declare type tab_names is table of varchar2(20) index by binary_integer; tab_name tab_names; coun number; str varchar2(100); begin select table_name bulk collect into tab_name from user_tables; for i in tab_name.first..tab_name.last loop str:='select count(*) from '||tab_name(i); execute immediate str into coun; dbms_output.put_line(tab_name(i)||'..........'||coun); end loop; end;
【答案解析】