1 Reply Latest reply: Dec 25, 2012 3:21 AM by MST RSS

    forms 6i problem code

    yasser_egypt
      dear sirs.
      I have this procedure on button on form to read text file and insert every text file into every records on the database text items on form, but it insert only in one record, tell me please how to solve this problem
      the code here
      ----
      PROCEDURE Get_File IS

      MYFILE           TEXT_IO.FILE_TYPE;
      filename           VARCHAR2(512); -- filename must include path and name
      LINEBUF           VARCHAR2(32766); -- 1 char less than 32k to account for line feed
      temp               VARCHAR2(32767);
      no_file exception;
      pragma exception_init (no_file,-302000);

      BEGIN
           if filename is null then
           filename := 'E:\STUDY\experiences\forms\tour\countries.txt';
           end if;
      MYFILE := TEXT_IO.FOPEN(FILENAME, 'R');
           SYNCHRONIZE;
      LOOP
      TEXT_IO.GET_LINE(MYFILE, LINEBUF);
      temp := temp + (length (LINEBUF));
      :country_code := LINEBUF || CHR(10);
      go_block('COUNTRIES');
      create_record;

      END LOOP;
      EXCEPTION
           when no_file then
           message('you can not access here. ' );
      END;
        • 1. Re: forms 6i problem code
          MST
          Please use below one:

          BEGIN
          if filename is null then
          filename := 'E:\STUDY\experiences\forms\tour\countries.txt';
          end if;
          MYFILE := TEXT_IO.FOPEN(FILENAME, 'R');
          SYNCHRONIZE;
          LOOP
          TEXT_IO.GET_LINE(MYFILE, LINEBUF);
          temp := temp + (length (LINEBUF));
          go_block('COUNTRIES');
          last_record; ---------------------------------
          next_record; ----------------------------------
          :country_code := LINEBUF || CHR(10);
          create_record;
          END LOOP;
          EXCEPTION
          when no_file then
          message('you can not access here. ' );
          END;