开发者

Dump the body of a function or procedure in sqlplus

开发者 https://www.devze.com 2022-12-14 00:18 出处:网络
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

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

精彩评论

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