patternMinor
Identify which parameters were passed to a procedure (Oracle)
Viewed 0 times
identifypassedprocedurewerewhichoracleparameters
Problem
Procedures in PL/SQL can have default values for parameters, but the caller can pass values that are identical to the default values. Is there a way from within the PL/SQL to determine whether a parameter is passed? As implied this cannot be done by comparing the value with the default value.
Solution
So the way I do this is I don't use default values. Or rather, I set them to NULL as default. Then within my procedure body I check to see if it's equal to NULL and if so set it to a sane default. At that point you could mangle a flag or two in the same space to see what's being set or not set.
However, there's the edge case of if they intended to pass in NULL for some reason. However, most devs don't deal well with tripletcase, so I don't usually worry about that (additionally, if I'm passing in a value, I need to pass a value, not null, so null for me means never-was-defined)
However, there's the edge case of if they intended to pass in NULL for some reason. However, most devs don't deal well with tripletcase, so I don't usually worry about that (additionally, if I'm passing in a value, I need to pass a value, not null, so null for me means never-was-defined)
Context
StackExchange Database Administrators Q#706, answer score: 6
Revisions (0)
No revisions yet.