Code coverage for PL/SQL

后端 未结 5 397
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-05 22:55

Does anyone have tools or experience with code coverage for PL/SQL. I believe this is possible using DBMS_PROFILER?

5条回答
  •  囚心锁ツ
    2021-02-05 23:34

    I found something useful on http://www.databasejournal.com/features/oracle/article.php/10893_2197231_3 page.

    select exec.cnt/total.cnt * 100 "Code% coverage"
    from  (select count(1) cnt
          from plsql_profiler_data d, plsql_profiler_units u
          where d.runid = &&runid
          and u.runid = d.runid
          and u.unit_number = d.unit_number
          and u.unit_name = upper('&&name')
          and u.unit_owner = upper('&&owner')
          ) total,
         (select count(1) cnt
          from plsql_profiler_data d, plsql_profiler_units u
          where d.runid = &&runid
          and u.runid = d.runid
          and u.unit_number = d.unit_number
          and u.unit_name = upper('&&name')
          and u.unit_owner = upper('&&owner')
          and d.total_occur > 0) exec;
    

提交回复
热议问题