DBAsupport.com Forums - Powered by vBulletin
Results 1 to 1 of 1

Thread: reading from files in plsql

  1. #1
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334

    reading from files in plsql

    I have this snippet of code which reads in, line by line a two field file, seperated by whitespace and assigns the two fields to two different variables (file name gets passed into the procedure).

    The in_line is a defined variable (varchar2) which holds the line we are dealing with. the V_StrLength is the length of the line
    Code:
     BEGIN
       v_PBLRec.Account_ID:=substr(in_line,1,inst(in_line,' ',1)-1);
        i := instr(in_line,' ',1);
         For j in 1..V_StrLength LOOP
          V_temp:=substr(in_line,i,1);
           IF v_temp<>' ' then
             v_PBLRec.Prepaid_Credit_Balance := rtrim(substr(in_line,i));
             EXIT;
           END IF;
          i := i+1;
          END LOOP;
          IF v_PBLRec.Prepaid_Credit_Balance is null then
             IF UTL_FILE.IS_OPEN (File_Handle) THEN
              UTL_FILE.PUTF(File_Handle, '%s.Line Skipped.\n',v_ReadCnt);
             END IF;
             v_RejOtherCnt   := v_RejOtherCnt + 1;
          ELSE
    
                    BEGIN .....
    What I would like to do is change this to read the same two values in from a different format of file. Basically i want to pull out characters 17 to 25 of the file for the v_PBLRec.Account_ID variable and add a 0 to the front of it. Then pull out characters 35 to 44 and strip off any leading 0's and assign that to the v_PBLRec.Prepaid_Credit_Balance variable.

    Can anyone help me, as you can see i'm not a pl/sql developer. Just been asked to change some code and im stuck on this one part

    Thanks

    Dave
    Last edited by davey23uk; 01-31-2003 at 04:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width