I wrote below FUNCTION to check given reference number is exist.
FUNCTION find_reference_no(
p_ref_no IN VARCHAR2) RETURN VARCHAR2
AS
v_ref_no varchar2(50);
BEGIN
select REF_NO into v_ref_no from cash where REF_NO = p_ref_no;
EXCEPTION
WHEN no_data_found THEN
v_ref_no := '#';
RETURN v_ref_no;
END;
I have called this function in a AFTER INSERT TRIGGER. when I'm inserting data, Ii'm getting error as
ORA-06503: PL/SQL: Function returned without value
How can I solve this ?
PS: I'm not inserting data into cash table. I'm inserting data into another table (assume it is table B) and called this function in it's (table B) AFTER INSERT TRIGGER.