开发者

Dump the body of a function or procedure in sqlplus

How can I dump out the body of a function or a pr开发者_C百科ocedure when using sqlplus to connect to an oracle database?


select
    text
from
    user_source
where
    type = 'PROCEDURE'
and
    name='YOURPROCEDURENAME'
order by
    line;


Use:

SELECT us.name,
       us.type,
       us.text
  FROM USER_SOURCE us
 WHERE us.type IN ('PROCEDURE', 'FUNCTION')
ORDER BY name, line


Another solution is to use the dbms_metadata api

set line 200
set long 10000
select dbms_metadata.ddl('PACKAGE','Package Name') from dual;

You can use this for all metadata including tables, indexes and constraints.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜