Your function calls are not identical, syntactically nor semantically. If you call the function in PL/SQL as you did in SQL, you will get the same exact error:
SQL> DECLARE
2 vinput VARCHAR2(255) := 'SRINI';
3 well VARCHAR2(50);
4 BEGIN
5 WELL := DBMS_OBFUSCATION_TOOLKIT.MD5(vinput);
6 dbms_output.put_line(well);
7 END;
8 /
ORA-06550: Ligne 5, colonne 12 :
PLS-00307: too many declarations of 'MD5' match this call
This is because the function called MD5
is overloaded in the package DBMS_OBFUSCATION_TOOLKIT
and you need to specify which function exactly to call.
In Oracle 11g, you can use the same synthax as PL/SQL:
SQL> DECLARE
2 vinput VARCHAR2(255) := 'SRINI';
3 well VARCHAR2(50);
4 BEGIN
5 SELECT DBMS_OBFUSCATION_TOOLKIT.MD5(input_string => VINPUT)
6 INTO WELL FROM DUAL;
7 dbms_output.put_line(well);
8 END;
9 /
Áýg¿Zq!Ù´¿Ke>ÏQ
PL/SQL procedure successfully completed
Before 11g, you can define a wrapper function:
SQL> CREATE OR REPLACE FUNCTION wrap_md5(input_string VARCHAR2)
2 RETURN dbms_obfuscation_toolkit.varchar2_checksum
3 IS
4 BEGIN
5 RETURN dbms_obfuscation_toolkit.md5(input_string => input_string);
6 END;
7 /
Function created
SQL> DECLARE
2 vinput VARCHAR2(255) := 'SRINI';
3 well VARCHAR2(50);
4 BEGIN
5 SELECT wrap_md5(VINPUT)
6 INTO WELL FROM DUAL;
7 dbms_output.put_line(well);
8 END;
9 /
Áýg¿Zq!Ù´¿Ke>ÏQ
PL/SQL procedure successfully completed