CREATE OR REPLACE FUNCTION get_dir_name (p_file IN VARCHAR2) RETURN varchar2
IS
v_dir_name VARCHAR2(1000);
BEGIN
/*
|| This Function returns a varchar2 string of the name of folder above the file name.
|| Written by: Daniel Coe
|| Date: 10/09/2002
*/
IF instr(p_file,’/’) > 0 THEN — Unix

v_dir_name := substr(p_file,1,(instr(p_file,’/’,-1,1)-1));

ELSIF instr(p_file,’\’) > 0 THEN — Windows

v_dir_name := substr(p_file,1,(instr(p_file,’\’,-1,1)-1));

END IF;

RETURN v_dir_name;
END;
/

How to get the directory name from a path
Tagged on:

Leave a Reply

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

ninety nine − = ninety six