Re: Query for specific procedure's source code

From: Maxim Demenko <>
Date: Sun, 01 Mar 2009 10:54:47 +0100
Message-ID: <>

Michael Austin schrieb:
> Adam Cameron wrote:
>> Hi
>> Is there any way one can query for a specific procedure's source code, 
>> rather than the entire package body that it's within?
>> I know I can query user_source for the package body, or for 
>> stand-alone procs, but I'm struggling to find a nice way of pulling 
>> out just the code for a specific proc within the package.
>> I suppose I can pull out everything between the start of the proc I 
>> want through to the start of the next proc, but I'd've thought there'd 
>> be a more elegant way of doing it than that?
>> I'm looking _at_ Oracle 9i at present, but I'd be keen to know about 
>> solutions for other releases too.  Any thoughts _at_ all, really.

> when posting an issue such as this, it is helpful if you include the
> full version (ie: 9.2.0.?)
> Check out:
> Summary of DBMS_METADATA Subprograms
> search for "procedure" on that page...

Afaik, there is no such method in Oracle. You can get the whole package source (either from *_source or with dbms_metadata ), but then you have to parse it to obtain a code for particular packaged procedure/function.
I personally would avoid to write a plsql parser in plsql. Perl,python,java,whatever else are much better suitable for that (it is not as trivial as to search for "procedure foo", even not with "regexp_like(text,"procedure\s+foo") etc).

Best regards

Maxim Received on Sun Mar 01 2009 - 03:54:47 CST

Original text of this message