CREATE OR REPLACE FUNCTION get_file_suffix (p_file IN VARCHAR2) RETURN varchar2
IS
v_file_suffix VARCHAR2(5);
BEGIN
BEGIN
/*
|| This Function returns a varchar2 string of the file suffix – any suffix length is returned,
|| If no suffix exists then NULL is returned.
|| Written by: Daniel Coe
|| Date: 10/09/2002
*/
v_file_suffix := substr(p_file,(instr(p_file,’.’,-1,1)+1),length(p_file));

EXCEPTION
WHEN value_error THEN
v_file_suffix := NULL;

END;

RETURN v_file_suffix;
END;
/

How to get the file suffix from a full path

Leave a Reply

Your email address will not be published. Required fields are marked *

twenty eight − = 23