UTL-FILE-Check if arquivo.txt is empty or no data

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Tue, 26 Feb 2008 11:54 am

Guys, I need to read and verify há records in two .txt files: ARQ_ENTRADA_1.txt ARQ_ENTRADA_2.txt before starting the procedure, is necessary to verify if you have data in two files (ARQ_ENTRADA_1 and ARQ_ENTRADA_2).

To read and check out just one file ... I made some plays in the EXCEPTION.

The problem now is that I have to check the two files.

I'm looking for if there is some procedure to read and check the two .txt files.

If anyone knows ... também will be looking for.

Cheers
Julian Campagnoli
Location: MG e SP

Poston Tue, 26 Feb 2008 12:41 pm

See if it's empty?
uses the FILE_LENGTH of UTL_FILE, if 0 is done ...: shock:
ruevers
Location: sp


Poston Tue, 26 Feb 2008 3:00 pm

Thank you very much ruevers, that is exactly what I was looking for the syntax for using the UTL_LENGTH:
Code: Select all
DECLARE
    ex    BOOLEAN;
    flen  NUMBER;
    bsize NUMBER;
    VAR   NUMBER;

BEGIN
   UTL_FILE.FGETATTR('folder', 'nome_arquivo.txt', ex , bsize , flen);
   VAR := flen;
 
   DBMS_OUTPUT.PUT_LINE('FILE_LENGTH - QTDE DE LINHAS: ' || TO_CHAR(VAR));

END;
Julian Campagnoli
Location: MG e SP

Poston Tue, 26 Feb 2008 3:32 pm

OPS ... correct please!!! lol
Code: Select all
DECLARE
    ex    BOOLEAN;
    flen  NUMBER;
    bsize NUMBER;
    VAR   NUMBER;

BEGIN
   UTL_FILE.FGETATTR('folder', 'nome_arquivo.txt', ex , bsize , flen);
   VAR := bsize;

   DBMS_OUTPUT.PUT_LINE('FILE_LENGTH - QTDE DE LINHAS: ' || TO_CHAR(VAR));
 
END;
Julian Campagnoli
Location: MG e SP


  • See also
    Replies
    Views
    Last Post


      Return to PL/SQL

      Who is online

      Users browsing this forum: Bing [Bot] and 5 guests