8

I have a couple of very long procs in Oracle 2000+ lines with lots of calls. And I'd like to generate program flow Diagram (algorithm) for better understanding of the process for further refactoring.

It's not the code I wrote so I don't know the logic enough.

What would you advise to do in this case? I tried to draw a text-like flow but it takes lots of time and still hard to cover all the logic for understanding.

The best approach I see would be flow chart generated from SQL proc with links to "jump" between code and chart.

UPDATE: Found couple of software doing the same:

  1. ClearSQL - makes CRUD diagrams, call map, and flow chart.

  2. Quest SQL Navigator Expert (using it now): it has Outline (makes code flow with ability to collapse-expand blocks of code - really cool one!), Code Explorer (enumerates all func, params with links ti SQL text - just in interface) features

1
  • The question comes down to suggest a tool, software, library which is kind of offtopic. Feb 15, 2015 at 10:56

2 Answers 2

9

There is a product, Code Visual to Flowchart, which can take code in various languages and do something like what you're describing. Unfortunately though Oracle doesn't appear to be in the list of supported languages, but Microsoft TSQL is; maybe you could at least translate your proc from Oracle into MS and use this to roughly visualize your proc's flow.

Failing that burnall's suggestion sounds like the best way to go, essentially divide and conquer.

3
  • As far as I see "PL/SQL, T-SQL(Transact-sql) to Flowchart," - Oracle is supported. Thanks, I'll try!
    – zmische
    Jan 27, 2010 at 14:35
  • 1
    I tried - except big hangs on my Proc - it works: code flow, diagram, plsql-to chart mapping. Thanks!
    – zmische
    Jan 27, 2010 at 14:49
  • 1
    Found another one soft of this type - ConquestSoft ClearSQL. Going to try it now.
    – zmische
    Jan 27, 2010 at 18:55
3

I doubt that such tool, even if it exists could help better understanding. I think, time of big flow-charts is over.
I would advice to understand logic with step-by-step refactoring:
iteratively extract parts of procedure to smaller procedures and add tests.

3
  • No, I mean Flow Chart of "big pieces of groups of logic" with possibility to see the code at the same time. I tried to debug but it was crazy - stepping tons of procs with tons of params - I just cant "load" that into my mind. Extractions, seems to me, doesnt really help - I have a big proc with cursor iterations on top level and lots of checks and proc calls inside - just cant imagine what I can extract... Thats a problem.
    – zmische
    Jan 27, 2010 at 14:27
  • 1
    May be flowcharts is helpful for your cognition style. I am glad if so. Really it is a case of the very common problem: how to understand and support big old programs which possibly were not created by genius)
    – burnall
    Jan 27, 2010 at 15:41
  • yes, YOU are right. Those big old progs...
    – zmische
    Jan 27, 2010 at 18:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.