Unable to pass varchar2 datatype in my function. Below is my code:
create 
or replace function f1(i varchar2) return varchar is j varchar2(10);
begin
   select
      last_name into j 
   from
      employees 
   where
      first_name = 'I';
return j;
end
;
/
Select f1('Steven') from dual;
It is showing null value instead of returning the Name.
Advertisement
Answer
You need to reference your parameter without quotes in your where clause, not as 'I'.
create or replace function f1(i varchar2) return varchar is j varchar2(10); begin select last_name into j from per_all_people_f where first_name=i; return j; end;