导出存储程序的源代码

用类似的方法导出包,触发器,存储过程等源代码
SQL> conn hr/hr;
Connected.


SQL> select OBJECT_NAME,OBJECT_TYPE,CREATED,STATUS,TEMPORARY 
  2  from user_objects
  3  where OBJECT_TYPE in ('PROCEDURE','FUNCTION');

OBJECT_NAME          OBJECT_TYPE         CREATED   STATUS  T
-------------------- ------------------- --------- ------- -
SECURE_DML           PROCEDURE           29-NOV-11 VALID   N
ADD_JOB_HISTORY      PROCEDURE           29-NOV-11 VALID   N



SQL> desc ADD_JOB_HISTORY--查看参数
PROCEDURE ADD_JOB_HISTORY
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 P_EMP_ID                       NUMBER(6)               IN
 P_START_DATE                   DATE                    IN
 P_END_DATE                     DATE                    IN
 P_JOB_ID                       VARCHAR2(10)            IN
 P_DEPARTMENT_ID                NUMBER(4)               IN

SQL> select line,text from user_source where name = 'ADD_JOB_HISTORY';--查看内容

LINE TEXT
---- --------------------------------------------------------------------------------
   1 PROCEDURE add_job_history
   2   (  p_emp_id          job_history.employee_id%type
   3    , p_start_date      job_history.start_date%type
   4    , p_end_date        job_history.end_date%type
   5    , p_job_id          job_history.job_id%type
   6    , p_department_id   job_history.department_id%type
   7    )
   8 IS
   9 BEGIN
  10   INSERT INTO job_history (employee_id, start_date, end_date,
  11                            job_id, department_id)
  12     VALUES(p_emp_id, p_start_date, p_end_date, p_job_id, p_department_id);
  13 END add_job_history;

13 rows selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26465805/viewspace-712591/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26465805/viewspace-712591/

你可能感兴趣的:(导出存储程序的源代码)