How can I avoid the warning fom an unused parameter in PLSQ?
-
01-07-2019 - |
Question
Sometimes, in PL SQL you want to add a parameter to a Package, Function or Procedure in order to prepare future functionality. For example:
create or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number
is
Result number(12,2);
begin
Result := 10000;
IF char <> 'EUR' THEN
-- ERROR NOT IMPLEMENTED YET
END IF;
return(Result);
end doGetMyAccountMoney;also
It can lead to lots of warnings like
Compilation errors for FUNCTION APPUEMP_PRAC.DOGETMYACCOUNTMONEY
Error: Hint: Parameter 'Currency' is declared but never used in 'doGetMyAccountMoney'
Line: 1
What would be the best way to avoid those warnings?
Solution
I believe that this is controlled by the parameter PLSQL_WARNINGS, documented for 10gR2 here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams166.htm#REFRN10249
OTHER TIPS
If you didn't have the ability to alter the warning levels, you could just bind the parameter value to a dummy value and document that they are for future use.
Well, your example has several errors. Most importantly, you would need to change "char" to "Currency" in the IF statement; which as far as I can see would avoid the warning as well.
Disable non-severe PL/SQL warnings:
ALTER SESSION SET PLSQL_WARNINGS='ENABLE:SEVERE';
Well, are you sure you have the name and the right in the correct order in that declaration?
It complains about a parameter named 'Currency', but you aren't actually using it, are you?
On the other hand, you are using something called char, what is that?
Or perhaps my knowledge of PL/SQL is way off, if so, leave a comment and I'll delete this.