Step By Step PL/SQL Tutorial ( Second Step : Passing Parameter )

How to pass parameter to PL/SQL Function ? 


Now we now how to create function an already created one.  It is the time for creating a little bit useful function ; a function with parameter :)

CREATE OR REPLACE FUNCTION funct_user_source_count_name (param_name IN varchar2)
RETURN NUMBER
IS
   dummy NUMBER;
BEGIN
   SELECT  count(name) INTO dummy FROM user_source WHERE name = param_name;
   RETURN dummy;
END;
/

You are able to call from SQL like this ;

SELECT funct_user_source_count_name('MIGRATION_REPORT') from dual
 

No comments: