oracle中取得儲存過程、函式等pl sql原始碼的方法

cnhtm發表於2010-03-15

如果已經知道函式、儲存過程、body等plsql的名稱,可以透過查詢user_source(dba_sourceall_source)取得其原始碼

演示過程如下:

ora_test@oracle[/home/oracle]> sqlplus scott/tiger

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 16 16:27:27 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

scott@CNHTM> col text for a50;
scott@CNHTM>
scott@CNHTM> select b.line,b.text
2 from USER_SOURCE b
3 where b.name='P_TEST'
4 order by line;

LINE TEXT
---------- --------------------------------------------------
1 procedure p_test is
2 begin
3 dbms_output.enable(999999999);
4 for c in (select * from big_table)
5 loop
6 dbms_output.put_line(c.object_name);
7 end loop;
8
9 end p_test;

9 rows selected.

scott@CNHTM>

--end--

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22049049/viewspace-1031884/,如需轉載,請註明出處,否則將追究法律責任。

相關文章