根据条件筛选出来很多视图。现在我要查看视图的来源,比如用什么DB_LINK。但是ALL_VIEWS里面都是LONG字段,
无法DISTINCT 无法WHERE 也无法批量查看。请问有什么办法实现么

解决方案 »

  1.   


    -- 处理 LONG 数据的方法:Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 
    Connected as test@MSGDESQL> 
    SQL> create view myview as select sysdate s from dual ;
    View created
    SQL> create view v1 as select 1 rn from dual ;
    View created
    SQL> create table myviews
      2  as
      3  select view_name, to_lob(text) text from user_views ;
    Table created
    SQL> select view_name, to_char(text) view_ddl from myviews ;
    VIEW_NAME                      VIEW_DDL
    ------------------------------ ------------------------------
    MYVIEW                         select sysdate s from dual
    V1                             select 1 rn from dual
    SQL> drop view myview ;
    View dropped
    SQL> drop view v1 ;
    View dropped
    SQL> drop table myviews purge ;
    Table droppedSQL> 
      

  2.   

    谢谢版主。
    用TO_LOB可以取出来的。
    但是又有另外一个问题。当遇到只读用户的时候。无法创建临时表。
    我用PLSQL块会报错,用DB_LINK也不支持LOB。想在另外一个用户把USER_VIEWS拿过去也做不到。