views:

249

answers:

5

Sometimes, in PL SQL you want to add a parameter to a Package, Funtion or Procedure in order to prepare future functionallity. 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 thouse warnings?

Thanks in advance.

A: 

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.

Lasse V. Karlsen
+1  A: 

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.

Dave Costa
+1  A: 

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

David Aldridge
David, your answer is not bad. Usefull and not obvious. But I will like to avoid it just in a selective way. In some languages you can add some metadata to help the compiller. May be it is not posible.
borjab
+1  A: 

Disable non-severe PL/SQL warnings:

ALTER SESSION SET PLSQL_WARNINGS='ENABLE:SEVERE';
Sergey Stadnik
+2  A: 

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.

abliss