7
Answers

Dependent nested sp's

Karthik G

Karthik G

8y
353
1

orite

Is it possible to write a PL/SQL query/procedure to identify a complete list of a stored procedures dependencies? I'm only interested in identifying other stored procedures and I'd prefer not to limit the depth of nesting that it gets too either. For example, if A calls B, which calls C, which calls D, I'd want B, C and D reported as dependencies for A.

Answers (7)
1
Marjan Venema

Marjan Venema

NA 56 0 9y
Ah, hmm, then you are in a bit of a pickle. That is much harder.

You could try replacing any {0} (and {1}, {2}) with some RegEx and then trying to match the string you get at run time against that.

For example:

        Boolean AreEqual(string template, string text)
        {
            string regexed = template.Replace("{0}", ".*");
            regexed = template.Replace("{1}", ".*");
            regexed = template.Replace("{2}", ".*");

            Regex regex = new Regex(regexed);
            return regex.IsMatch(text);

        }

Please note, my RegEx skills are below par. And of course you would want to replace the replacements at the top with something more intelligent.

Cheers, Marjan
Accepted
1
Marjan Venema

Marjan Venema

NA 56 0 9y
If you have the value(s) of the arguments at runtime as well, then you could do something like: 

        Boolean Matches(string runTimeFullString, string runTimeArgument)
        {
            string FromDatabase = "The Cow is {0}";
            return runTimeFullString.Equals(string.Format(FromDatabase, runTimeArgument));
        }

If that doesn't help, could you please clarify what you are trying to achieve and what pieces of information you have to work with?
0
Murugesh P

Murugesh P

NA 179 5.7k 9y
Hi Marjan, Thanks for your response. Basically i have to compare two strings one from Resource file another from Databse. Ex: In Resource: The cow is {0} In Data Base: The cow is {0} But during run time the Parameter {0} will be filled and it becomes "The cow is white". So comparing The cow is {0} and The cow is White will be marked as difference. And Data base will not have run time parameters. So Basically i need to compare the strings without the Parameter {0}.
0
Abhineet Srivastava

Abhineet Srivastava

NA 1.1k 62.7k 9y
String.compare(s1,s2)
0
Suthish Nair

Suthish Nair

NA 31.7k 4.6m 9y
using String.Compare method.