Thursday, August 23, 2012

Script To Check the File On Database Server(Unix) Using UTL_FILE


Below Script is used to verify the file exists on the Server using PLSQL UTL_FILE functionality.

DECLARE
   l_fexists         BOOLEAN;
   l_file_length   NUMBER;
   l_block_size    NUMBER;
   l_file_name       VARCHAR2 (2000); -- Name if the file that needs to check on server
BEGIN
   UTL_FILE.fgetattr ('/usr/tmp'
                    , l_file_name
                    , l_fexists
                    , l_file_length
                    , l_block_size
                     );
   IF l_fexists
   THEN
      DBMS_OUTPUT.put_line ('The File exists');
    ELSE
      DBMS_OUTPUT.put_line ('The File dosent exists');
   END IF;
END;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.