-1

我提供了这段代码来获取一个数据库中所有模式的所有表描述。我在网上搜索并想出了下面的代码。我无法弄清楚错误。

任何可以帮助解决此错误或为我提供解决问题的方法的人

SQL>  Begin
  2    For q in (select distinct owner from dba_objects)
  3    loop
  4   for r in (select table_name, owner from all_tables where owner = 'q.owner')
  5   loop
  6    dbms_output.put_Line('table '||r.table_name);
  7    execute immediate 'desc ' || r.table_name
  8    end loop;
  9    end loop;
 10    end;
 11    /

end loop;
 *

ERROR at line 8:
ORA-06550: line 8, column 3:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
. ( * @ % & = - + ; < / > at in is mod remainder not rem
return returning <an exponent (**)> <> or != or ~= >= <= <>
and or like like2 like4 likec between into using || bulk
member submultiset
The symbol ";" was substituted for "END" to continue.
4

2 回答 2

1

尝试:

select   *
from     all_tab_columns
where    owner = 'MY_OWNER_NAME'
order by owner,
         table_name,
         column_id;

使用此处的参考来选择您感兴趣的列。例如,如果您只对字符数据类型感兴趣,则可以添加其他谓词。

于 2013-05-24T09:33:51.923 回答
0

第 7 行:execute immediate 'desc ' || r.table_name

你忘了放;

于 2013-05-24T09:23:07.810 回答