Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Counting the number of lines for each procedure in a package

952986Jul 31 2012 — edited May 23 2013
Hi,

I would like to write a query on USER_SOURCE that can display the number of code lines for each procedure/function in a package.
Is it possible to write such a query? Maybe by using analytical functions?

for example in the following example i would like to count the lines between "PROCEDURE proc1 IS" and "END proc1;" and between "PROCEDURE proc2 IS" and "END proc2;"
SQL> select text  from user_source where name='PKG_TEST' and type='PACKAGE BODY';

TEXT
--------------------------------------------------
PACKAGE BODY PKG_TEST IS
/*************************************************
****/

  PROCEDURE proc1 IS
  BEGIN
    update t1 set EDITION_NAME = 'AAAAAAA';
    commit;
  END proc1;

PROCEDURE proc2 IS
  BEGIN
   update t1 set EDITION_NAME = 'AAAAAAA';

    commit;
  END proc2;
END PKG_TEST;
thanks for helping
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2013
Added on Jul 31 2012
14 comments
8,099 views