Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> TEXT_IO Help Debug!

TEXT_IO Help Debug!

From: Sebas Santos <sebas_at_home.com>
Date: Wed, 17 Feb 1999 07:27:55 GMT
Message-ID: <36CA6FAB.65A82731@home.com>


/*
Sebastian Dos Santos
This procedure suppose to open a text file and insert into the buffer one line at a time,
according to the line size passed. Then prints the line and gets a new line until the
text is exhausted.
I have been reading about this powerfull function and would like to try an elegant
way of writting this procedure. I would love to know more about this "TEXT_IO", can you help?
*/
PROCEDURE FORMAT_REPORT

 (P_TEXT      IN  VARCHAR2,
   P_COLUMN_WIDTH     IN  NUMBER,
   P_BORDER_WIDTH     IN  NUMBER,
  P_LINES_PER_PAGE   IN  NUMBER,
   P_STATUS           OUT VARCHAR2)
IS
   in_file   TEXT_IO.FILE_TYPE     ;

   linebuf VARCHAR2 (P_COLUMN_WIDTH) ; BEGIN
SET PAGESIZE (P_LINES_PER_PAGE)
SET LINESIZE (2*P_BORDER_WIDTH + P_COLUMN_WIDTH)   in_file := TEXT_IO.FOPEN('p_text.txt', 'r');    IF in_file IS NULL
   THEN
  P_STATUS := 'There was aprocessing Error.'    ELSE
  P_STATUS IS NULL;
   END IF;
  LOOP
    TEXT_IO.GET_LINE(in_file, linebuf);
    TEXT_IO.PUT(LPAD(linebuf,5, ' '));
    TEXT_IO.NEW_LINE;

  END LOOP;
EXCEPTION
  WHEN no_data_found THEN
    TEXT_IO.PUT_LINE('Closing the file...');     TEXT_IO.FCLOSE(in_file);
  IF TEXT_IO.IS_OPEN(out_file)
  THEN
      TEXT_IO.FCLOSE(out_file);
  END IF;
END; Sebas <sebas_at_home.com> Received on Wed Feb 17 1999 - 01:27:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US