Oracle: how to view source code of stored procedure 

Joined:
04/09/2007
Posts:
753

September 13, 2008 20:52:47    Last update: September 15, 2008 23:04:35
The text source of the stored objects (including stored procedures) are made available in Oracle by three views:
  1. USER_SOURCE describes the text source of the stored objects owned by the current user. This view does not display the OWNER column.
  2. ALL_SOURCE describes the text source of the stored objects accessible to the current user.
  3. DBA_SOURCE describes the text source of all stored objects in the database.


These are the columns:

Column NameDescription
OWNEROwner of the object
NAMEName of the object
TYPEType of object: FUNCTION, JAVA SOURCE, PACKAGE, PACKAGE BODY, PROCEDURE, TRIGGER, TYPE, TYPE BODY
LINELine number of this line of source
TEXTText source of the stored object


If you want to search for a certain keyword in the source, this query may be helpful:
SELECT type, name, line
FROM   user_source
WHERE  UPPER(text) LIKE UPPER('%&SEARCH_STRING%');

Enter the string you are looking for when prompted for the value of SEARCH_STRING.
Share |
| Comment  | Tags