What is this SQL for, take a guess?

  • From: "Ethan Post" <post.ethan@xxxxxxxxx>
  • To: "Oracle Discussion List" <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 16 Mar 2006 00:48:41 -0600

I am pretty proud of this little bitty. Anyone want to take a swipe what it
could be used for? Oh and it will up in 'ur quest spotlight right out.



select name, next_line, t from (

select name, line, lead(line, 1) over (order by name, line) next_line, t,
lead(t, 1) over (order by name, line) t1 from (

select name, type, line, decode(instr(t, ' '), 0, t, substr(t,1,instr(t,'
'))) t from (

select name, type, line, trim(decode(substr(t,1,8),'FUNCTION',substr(t,10),
t)) t
  from (
select name, type, line, decode(substr(t,1,9),'PROCEDURE',substr(t,11), t) t
from (
(select name, type, line,
replace(upper(trim(translate(text,'('||chr(10)||chr(13)||chr(9),'    '))),
'  ', ' ') t
  from all_source where owner='SCOTT'
   and type not in ('PACKAGE','TRIGGER'))
) where (t not like '%CODE AND ALTERNATE PROCEDURE/REV CODE.%')
    and(t like 'PROCEDURE %' or t like 'BEGIN' or t like 'FUNCTION %')
 )))) where t <> 'BEGIN' and t1='BEGIN'

Other related posts: