What SQL do I use to get a list of functions and a list of procedures from the database? I need to get two distinct lists. This SQL brings back both procedures and functions in one list:
Thanks, Brad asked 05 Jan '10, 22:00 Brad Wery |
SQLA: 10.0.1
Then, of course, you could restrict based on Object_Type. Hope it helps! answered 05 Jan '10, 22:49 Calvin Allen Breck Carter I'll go with this for now. It works, that's all I need right now. It probably is the best solution. Sadly, the system catalog tables don't differentiate, with sysobject.object_type = 6 for both. ...Which leads to the question, how the database server differentiantes between both types? Or is this done in a context-sensitive way, i.e. CALL myFunction(1) is somewhat different from SELECT myFunction(1)? (AFAIK, using functions quite like procedures - including INOUT parameters and the like - is possible in older SA versions, adding to the conclusion that both types are more similar than expected). Yeah, there are also calls to 'drop procedure' and 'drop function'. How do they work? 1
Nevermind, I just answered my own question. 'drop procedure' will drop functions, and 'drop function' will drop procedures. Strange implementation. |
Just a backlink from a similar question: Karim has shown a better approach (IMHO) here, based on querying sysprocparm: For each function, that table contains an entry with parm_type = 4 for the function's return type - something that procedure do not have by design. So that should be a reliable way to differentiate them. answered 31 May '11, 11:28 Volker Barth |