Text_io pakage

Hi!
I want to read data through text.io package but file type is data i-e LIST.DATA
I want to know can I read and write data in these files which have extension Data instead of TXT.
In addition file contains data which has <TAB> delimited records I want to know that how can I recognized these <TAB> in text file.
Thanks in advance
Best regrads
Ali hasan

1)First of all Text_io can be used only in Oracle forms for reading & writing from Client side . In sql plus u need to use UTL_File , External tables for manupulating the server side files.
2)Secondly u can use .dat files for reading & writing.
3)Lastly if using text_io u can use ASCII function to look for TAB as ascii of TAB is 9 hence can use ascii for looking for tab seperated file.
In case of External Table U can mention the seperator while creating the external table like
create table ext_table_tab (
n Varchar2(20),
m Varchar2(20)
organization external (
type oracle_loader
default directory ext_dir
access parameters (
records delimited by newline
fields terminated by '     '
missing field values are null
location ('file1.txt')
)

Similar Messages

  • Problem with reports in excel (using text_io)

    we are using Report Builder 6.0.5.28.0 with Oracle9i Enterprise Edition Release 9.2.0.1.0. in a client/server evironment. I'm using 'TEXT_IO' to write the report output to a csv file.
    The process runs ok but the only problem is that the first line of every page (other than the first) gets repeated.
    can anyone out there tell me how to get over this problem.
    Thanx in advance
    Adolph

    1. You first need to create a package in your report
    PACKAGE conv_text IS
    procedure fopen(fname varchar2);
    procedure fclose(fname varchar2);
    procedure fwrite_c(fname varchar2,
    var_c varchar2);
    procedure fline;
    END;
    PACKAGE BODY conv_text IS
    o_file TEXT_IO.FILE_TYPE;
    filename VARCHAR2(50);
    procedure fopen (fname varchar2) is
    begin
    filename := fname;
    o_file := TEXT_IO.FOPEN(filename,'W');
    end;
    procedure fclose (fname varchar2) is
    begin
    Text_IO.Fclose(o_file);
    end;
    procedure fwrite_c (fname varchar2, var_c varchar2) is
    begin
              Text_IO.Put(o_file,var_c);
    end;
    procedure fline is
    begin
         Text_IO.New_Line(o_file);
    end;
    2. In the "before report trigger" open the csv file (make sure the folder exists on the client m/c)
    conv_text.fopen(:filename);
    3. In the innermost frame(use the following,for all the fields u want in ur csv file) :
    filename VARCHAR2(50);
    begin
    filename := :filename;
    conv_text.fwrite_c(filename,:agency_name);
    conv_text.fwrite_c(filename,',');
    conv_text.fwrite_c(filename,:invoice_no);
    conv_text.fwrite_c(filename,',');
    conv_text.fline;
    4. In the after report, close the file
    conv_text.fclose(:filename);
    good luck and let me know if get thru with the problem of the repeating record.
    Adolph
    [email protected]

  • Issue is TEXT_IO application API is not working in report builder 10g.

    Issue is TEXT_IO application API is not working in report builder 10g.
    TEXT_IO application api is working in report builder 6i. (Not working in upgrade from Oracle EBiz 11i to Oracle Ebiz R12)
    I saw that details in some forums, client_text_io is available for form builder 10g.
    Is any other api available for report builder 10g?
    If it is available what steps we need to do?

    All the CLIENT_% procedures are part of webutil in Forms. Forms uses the Java applet on the client PC to perform actions on the local PC via webutil. This is not possible for Reports.
    You can still use text_io on the server, but you need some other way to copy the files to/from the client PC.
    I wonder how you used the functionality in EBS R11. Even R11 uses web reports, so text_io already worked on the server, not the client PC.

  • Need help text_io function not working in 11i

    Hi,
    I am new in form devlopment Kindly help
    We create a customize form on 6i then deploye it on our Oracle apps Server with EBS. I want to create a form using form 6i which read a text file from client side and insert data into table i try text_io function but its not working after deployed form on server and also try webutil function but its not working with oracle forms 6i kindly help how can i do this while using forms 6i i will be very thankful.
    Thanks

    Hi;
    Please check first below link
    Forms 6i Developer and Forms 6i Services - Demonstrations and Sample Code
    http://www.oracle.com/technology/sample_code/products/forms/6idemos.html
    Also check below googling which exists for step by step guide
    www.pdfoo.com/result-Oracle-forms-6i-step-by-step-tutorial.html
    www.pdfoo.com/resultpage9~forms-6i-step-by-step-application-development -examples.html
    Also see:
    http://www.google.com.tr/#hl=tr&biw=1259&bih=793&q=forms+6i%2Bstep+by+step&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=71a534c4a5161590
    Regard
    Helios

  • TEXT_IO.FOPEN not working on web deployed app FORMS 6i

    Hi all
    I have coded parsing file by using TEXT_IO.GET_LINE but it seems that my file even can't be opened.
    declare
    file1 text_io.file_type;
    filename1 varchar(256);
    linebuf varchar2(100);
    begin
    file1 := TEXT_IO.FOPEN(:CSV.CSV_PATH, 'r');
    Text_IO.Get_Line(file1, linebuf);
    if linebuf!='blablablablabla' then msg('line is OK!');
    else msg('Line is wrong!');
    end if;
    TEXT_IO.FCLOSE(file1);
    end;
    On local machine when i enter into :CSV.CSV_PATH "C:\details.txt" the file gets loaded because it gets processing, I can see messages.
    When I upload form onto remote web-deployed app server, I enter into path "D:\details.txt" (I cannot write on C:, the files are the same) nothing happens. Does it mean text_io won't work on Fomrs6i web-deployed? How can I investigate this issue.
    Thanks in advance
    Tome

    With Forms Server deployments. TEXT_IO writes the file on the Forms server not the local PC as it did in client-server mode.
    Here are some workarounds
    1) Download the WEBUTIL add-on from Oracle and use its TEXT_IO package to write to the local file.
    WebUtil is an essential add-on loaded with goodies such as a file browse dialog for local files. Its easy to use and is designed to be compatible with other oracle routines like TEXT_IO.
    Kudos to Duncan Mills at Oracle for this top add-on - dont leave home without it.
    www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm2) Use the original TEXT_IO (as you are now) to write to a file on the Forms Sever , then display it in a browser window using WEB.SHOW_DOCUMENT
    3) I remember seeing some some old Java scripts on OTN to write to local PC.
    MY APOLOGIES for #3. Most forum posts can be solved with that little gem of an answer. "My sink is blocked" ... "yeah I saw some java code to fix that"

  • TEXT_IO.PUT_LINE resulting in partial file at a consistant size of 40KB

    Overview:
    In client server mode the report opens a file on the desktop, writes a tab delimited text line for a specific repeating frame and then closes the file. However, the resulting file is incomplete but the previewer displays the compete report with no error. The first 40K contains text lines that are OK and then the output just stops at one line at the 40K threshold even if I change the data model query to select different data. This appears to be a max size buffer size but I'm not sure. I know that the UTL_FILE on the database contains a FFLUSH function but no such function exists for TEXT_IO. Hum...
    Any ideas?
    Report Text_io steps:
    1. After Form trigger:
    s_file.out_file := TEXT_IO.FOPEN('c:\temp\output_file.tab', 'W');
    2. Repeating frame format trigger:
    buf:='';
    buf:=to_char(nvl(:QTY,0))||CHR(9);
    buf:=buf || to_char(nvl(:M_PRICE1,0))||CHR(9);
    TEXT_IO.PUT_LINE(s_file.out_file,buf);
    3. After Report trigger:
    TEXT_IO.FCLOSE(s_file.out_file);

    I seem to recall having a similar problem. I thought it was that the after report trigger was not firing properly (i.e. at all).
    I solved it by putting a field at the end of the report (outside the topmost repeating frame) and attaching the code to that

  • Error while inserting data in Forms10G using TEXT_IO

    Dear all i am using 10g Forms.
    I am using Text_io to read the text file and putting into table and again reading the tables and putting into another text file .
    I was testing in 3 tables which is the same copy of the original table but only the name is different .
    But after testing when i change the table name to Original table name , it is not inserting for 1 table .
    What could be the reason ?
    I already check the columns and all , everything is current .
    Edited by: Sandy on Sep 14, 2010 5:39 PM

    Please use tags when posting your code over here and format it proper so others can read it more easily.
    e.g.
    [code]
    procedure my_proc is
      num_data number;
    begin
      select 1
      into num_data
      from dual;
      if num_data = 2 then
    end;
    [/code]
    Are you sure you are getting here:
    [code]
    INSERT INTO MU_PAY_OLB(RECORD_TYPE,LOAD_NO,TRAN_AMT,OLB_CODE,ACCT_NO,BEN_NAME,PAY_DTL,MACCS_IND)
    VALUES(lval,l_val,DTL_AMT,lbank,DTL_BEN_AC_NO,DTL_BEN_NM,Null,'N');
    [/code]
    Also: only trap the exceptions you expect, and not ALL exceptions e.g.
    [code]
    begin
      INSERT INTO MU_PAY_OLB(RECORD_TYPE,LOAD_NO,TRAN_AMT,OLB_CODE,ACCT_NO,BEN_NAME,PAY_DTL,MACCS_IND)
      VALUES(lval,l_val,DTL_AMT,lbank,DTL_BEN_AC_NO,DTL_BEN_NM,Null,'N');
    exception
      when dup_val_on_index then
        --do whatever you need to do in that case
    end;
    [/code]
    Maybe your tablespace is full and thus your insert statement fails? You need to inform the user so he/she can inform the DBA.
    and at last this one:
    [code]
    WHEN Others THEN
      Text_IO.Fclose(in_file);
    END;
    [/code]
    You are hiding all possible exceptions; it might be a numeric or value error as the line you are reading is longer then your line buffer, or $add_any_possible_exception_here. You only close the file and behave like nothing ever happened. If you need to close your text file in any case it should look like this:
    [code]
    exception
      when others then
        if text_io.is_open(in_file) then
          text_io.fclose(in_file);
        end if;
        raise;
    end;
    [/code]
    By that you are closing the file if necessary (the exception might occur after you closed the file and closing it again will cause another exception), and reraise your exception so it can be processed by the higher element in the call stack; maybe your calling procedure expects some exceptions in your procedure too and handles them respectively. If no one in the call stack expects the exception and traps it, it finds it's way to the end user (who is you in that case). If it throws an exception take a look where it happens and take actions.
    So remove your when others exceptions and look if some other exceptions occur. By now there might occur an exceptions but as you are hiding them all we and you have no clue about if, when, why and where it happens. Remove / replace the exception handlers as shown and you should get a clue about if, when, why and where.
    cheers                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • TEXT_IO ...  replace first line

    Hello,
    i have a small Problem with the TEXT_IO.PUT_LINE builtin
    I want to write and read a .txt file with TEXT_IO
    It workes fine but if i use put_line to write something in, it replace all inside my .txt file
    My Question: Is it possible to replace only the first line inside my txt file
    Example Forms:
    Declare
         filename           varchar2(30) := 't:\test\Laufzettel.txt';
         file_handle TEXT_IO.FILE_TYPE;
         umrechnung number;
    BEGIN
    If :parameter.intervall is not null then
         file_handle := TEXT_IO.FOPEN(filename, 'W');
         umrechnung := :button.intervall;
         umrechnung := round(((umrechnung*60)*1000));
         TEXT_IO.PUT_LINE(file_handle,umrechnung);     
         TEXT_IO.FCLOSE(file_handle);
    end if;
    END;
    and the .txt file looks like this:
    6000
    CT
    CT2
    Mammo
    MR
    US
    Bestrahlung
    MRT
    NUK
    SD
    i want to replace the 6000 with another number without rewriting all the other entrys?!
    Sorry for my bad English :)
    Message was edited by:
    user628271

    If you are unix use grep command to replace the string. And this grep command can be called using host.
    If you are in Windows , create a new file from the original and while creating you
    can replace which ever line you needed.
    Once you create the new file , delete the original file using host command.
    Once you delete the old file, copy the new file to the original file name using host command.
    Rajesh Alex

  • How to read file WITHOUT full path using TEXT_IO?

    We have a scenario like this:
    -- We have a Telco application.
    -- That has 3 types of installations. English and Spanish
    -- We have 2 App Servers (Eng & Spa) for the 2 installation types.
    -- But there is only ONE DB. I.e. users logging into Eng or Spa AS versions login to the same DB.
    -- We have to maintain 2 login forms because of Eng and Spa, because the menu labels have to come in 2 langs.
    -- I am trying to have one tree menu for this.
    -- To do this I did this.
    -- Put a text file in the Forms directory of the AS.
    -- The file has just one line. ENGLISH or SPANISH.
    -- I read this file and find out the language and then show labels according the language.
    Problem is that when I used TEXT_IO and gave file name like this filename:=GET_FILE_NAME('Avabill_AS_Language.txt', File_Filter=>'Text Files (*.txt)|*.txt|');
    I get a error saying file not found.
    I found out that with TEXT_IO you need FULL PATH of the file. Thing is path of the installation depends of installation to installation. I cannot create a parameter in the DB since the DB is COMMON. I HAVE TO use a text file in the AS directory.
    Is there any other way like reading the Default.env file or FormsWeb.cfg? Is there a parameter in any of these files which specifies the forms directory absolute path. I studied both file but could not find an entry.
    Any workaround would be greatly appreciated.

    Thanks BaiG for the quick response.
    U r right about that GET_FILE_NAME.
    I removed that and put the file name only and tried. Still get the same error.
    FUNCTION Avabill_Deployment_Type RETURN VARCHAR2 IS
    v_language VARCHAR2(100);
    in_file Text_IO.File_Type;
    BEGIN
    in_file := Text_IO.Fopen( *'Avabill_AS_Language.txt'* , 'r');
    Text_IO.Get_Line(in_file, v_language );
    Text_IO.Fclose(in_file);
    RETURN v_language;
    EXCEPTION
    WHEN OTHERS THEN
    Text_IO.Fclose(in_file);
    ALERT_MESSAGE(1,'FILE NOT FOUND: ' || SQLERRM);
    RETURN 'Normal';
    END;
    I get this error:
    *302000: non-ORACLE exception*
    As for you query:
    -- We have 2 app servers. One English and One Spanish.
    -- So we have 2 sets of forms. One English with English labels in the forms and the other with Spanish Labels.
    -- So we HAVE to have 2 menu forms as well, don't we? When the menu form is run how does it know whether the app server is English or Spanish.
    -- There is no way to find out. We cannot use a DB variable since BOTH use the same DB (at the same time). Eng users will enter in English while Spanish users will enter in Spanish.
    I don't see how we can have one menu form for this purpose. Can u elaborate your method further please?

  • Create a file using text_io package

    Hi my friends,
    I would like to direct the output from my Reports to a file.
    I was searching in Oracle Forum and I found:
    1.in the before report trigger open a file(.txt file) for write mode using text_io.fopen. You can specify the file name with whatever path u want.
    2.Whatever fields from the report you want to redirect to the this file, go to the repeating frame of that field and use text_io.put or put_line.
    How to I could do this?????
    3.Finally , maybe in the after report or whereever close the file you opened using text_io.close.
    Someone, could give more information about this?
    Thanks...
    Carla

    Hi Carla
    What I understand from your words is that you want to write out a file based on your query in the report using the text_io package.
    You could be doing this in the Format Trigger of the appropriate Repeating Frame.
    You could also be using Delimited output and choose an appropriate delimiter character.
    With Reports 9i, you could be doing File I/O operations using Java calls by importing a Java class.
    Hope this helps.
    Regards
    Sripathy

  • Reading data from flat file Using TEXT_IO

    Dear Gurus
    I already posted this question but this time i need some other changes .....Sorry for that ..
    I am using 10G forms and using TEXT_IO for reading data from flat file ..
    My data is like this :-
    0|BP-V1|20100928|01|1|2430962.89|27|2430962.89|MUR|20100928120106
    9|2430962.89|000111111111|
    1|61304.88|000014104113|
    1|41961.73|000022096086|
    1|38475.65|000023640081|
    1|49749.34|000032133154|
    1|35572.46|000033093377|
    1|246671.01|000042148111|
    Here each column is separated by | . I want to read all the columns and want to do some validation .
    How can i do ?
    Initially my requirement was to read only 2 or 3 columns so i did like this ...
    Procedure Pay_Simulator(lfile_type varchar2,lac_no varchar2,lcur varchar2,lno_item number,ltotal number,ldate date,lpay_purp varchar2,lfile_name varchar2)
    IS
    v_handle utl_file.file_type;
    v_filebuffer varchar2(500);
    line_0_date VARCHAR2 (10);
    line_0_Purp VARCHAR2 (10);
    line_0_count Number;
    line_0_sum number(12,2);
    line_0_ccy Varchar2(3);
    line_9_sum Number(12,2);
    line_9_Acc_no Varchar2(12);
    Line_1_Sum Number(12,2);
    Line_1_tot Number(15,2) := 0;
    Line_1_flag Number := 0;
    lval number;
    lacno varchar2(16);
    v_file varchar2(20);
    v_path varchar2(50);
    Begin
    v_file := mcb_simulator_pkg.GET_FILENAME(lfile_name); -- For the file name
    v_path :=rtrim(regexp_substr( lfile_name , '.*\\' ),'\'); For the Path
    v_path := SUBSTR (lfile_name,0, INSTR (lfile_name, '\', -1));
    v_handle := UTL_FILE.fopen (v_path, v_file, 'r');
    LOOP
    UTL_FILE.get_line (v_handle, v_filebuffer);
    IF SUBSTR (v_filebuffer, 0, 1) = '0' THEN
    SELECT line_0 INTO line_0_date
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 3;
    SELECT line_0 INTO line_0_Purp
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 4;
    SELECT line_0 INTO line_0_count
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 7;
    SELECT line_0 INTO line_0_sum
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 8;
    SELECT line_0 INTO line_0_ccy
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 9;
    ELSIF SUBSTR (v_filebuffer, 0, 1) = '9' THEN
    SELECT line_9 INTO line_9_Acc_no
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_9, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 3;
    SELECT line_9 INTO line_9_sum
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_9, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 2;
    ELSIF SUBSTR (v_filebuffer, 0, 1) = '1' THEN
    line_1_flag := line_1_flag+1;
    SELECT line_1 INTO line_1_sum
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_1, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 3;
    Line_1_tot := Line_1_tot + line_1_sum;
    END IF;
    END LOOP;
    DBMS_OUTPUT.put_line (Line_1_tot);
    DBMS_OUTPUT.PUT_LINE (Line_1_flag);
    UTL_FILE.fclose (v_handle);
    END;
    But now how can i do ? Shall i use like this select Statement for all the columns ?

    Sorry for that ..
    As per our requirement ...
    I need to read the flat file and it looks like like this .
    *0|BP-V1|20100928|01|1|2430962.89|9|2430962.89|MUR|20100928120106*
    *9|2430962.89|000111111111|*
    *1|61304.88|000014104113|*
    *1|41961.73|000022096086|*
    *1|38475.65|000023640081|*
    *1|49749.34|000032133154|*
    *1|35572.46|000033093377|*
    *1|246671.01|000042148111|*
    *1|120737.25|000053101979|*
    *1|151898.79|000082139768|*
    *1|84182.34|000082485593|*
    I have to check the file :-
    Validation are 1st line should start from 0 else it should raise an error and insert that error into one table .
    The for 2nd line also same thing ..it should start from 9 else it should raise an error and insert that error into one table .
    Then the 3rd line should start from 1 else it should raise an error and insert that error into one table .
    After that i have to do a validation like i will read the 1st line 2nd column .. It should be like this BP-V1 else raise an error and insert that error to a table . Then i will check the 3rd column which is 20100928 , it should be YYYYMMDD format else same thing ERROR.
    Then like this for all columns i have different validation .......
    Then it will check for the 2nd line 3rd column . this is an account no .1st i will check it should be 12 char else ERROR .Then I will check that what user has imputed in the form.Like for example User putted 111111111 then i will check with this 000111111111 which is there in the 2nd line . I have to add 000 before that Account no which user imputed .
    Then the lines which is starting from 1 , i have to take all the 2nd column for all the lines which is starting from 1 and i have to do a sum . After that i have to compare that sum with the value in the 1st lines ( Starting from 0) 6th column . It should be same else ERROR ...
    Then same way i have to count all the lines which is starting from 1 . Then i have to compare with the 7th column of 1st line . It should be same . Here in this file it should be 9.
    MY CODE IS :-
    Procedure Pay_Simulator(lfile_type varchar2,lac_no varchar2,lcur varchar2,lno_item number,ltotal number,ldate date,lpay_purp varchar2,lfile_name varchar2)
    IS
    v_handle TEXT_IO.file_type;
    v_filebuffer varchar2(500);
    line_0_date VARCHAR2 (10);
    line_0_Purp VARCHAR2 (10);
    line_0_count Number;
    line_0_sum number(12,2);
    line_0_ccy Varchar2(3);
    line_9_sum Number(12,2);
    line_9_Acc_no Varchar2(12);
    Line_1_Sum Number(12,2);
    Line_1_tot Number(15,2) := 0;
    Line_1_flag Number := 0;
    lval number;
    lacno varchar2(16);
    v_file varchar2(20);
    v_path varchar2(50);
    LC$String VARCHAR2(50) ;--:= 'one|two|three|four|five|six|seven' ;
    LC$Token VARCHAR2(100) ;
    i PLS_INTEGER := 2 ;
    lfirst_char number;
    lvalue Varchar2(100) ;
    Begin
    v_file := mcb_simulator_pkg.GET_FILENAME(lfile_name); For the file name
    v_path :=rtrim(regexp_substr( lfile_name , '.*\\' ),'\'); For the Path
    --v_path := SUBSTR (lfile_name,0, INSTR (lfile_name, '\', -1));
    Message(lfile_name);
    v_handle := TEXT_IO.fopen(lfile_name, 'r');
              BEGIN
                        LOOP
                        TEXT_IO.get_line (v_handle, v_filebuffer);
                        lfirst_char := Substr(v_filebuffer,0,1);
                        --Message('First Char '||lfirst_char); 
                                  IF lfirst_char = '0' Then
                                  Loop
                                  LC$Token := mcb_simulator_pkg.Split( v_filebuffer, i , '|') ;
                                  Message('VAL - '||LC$Token);
                                  lvalue := LC$Token;
                                  EXIT WHEN LC$Token IS NULL ;
    i := i + 1 ;
    End Loop;
                                  Else
                                       Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (9999,'0002','First line should always start with 0');
                                       Forms_DDL('Commit');
                                       raise form_Trigger_failure;
                                  End if ;
                        TEXT_IO.get_line (v_handle, v_filebuffer);
                        lfirst_char := Substr(v_filebuffer,0,1);
                        LC$Token := mcb_simulator_pkg.Split( v_filebuffer, i , '|') ;
                        --Message('Row '||LC$Token);
                             IF lfirst_char = '9' Then
                                  Null;
                             Else
                                  Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (8888,'0016','Second line should start with 9');
                                  Forms_DDL('Commit');
                                  raise form_Trigger_failure;
                             End IF;
                        LOOP
                        TEXT_IO.get_line (v_handle, v_filebuffer);
                        lfirst_char := Substr(v_filebuffer,0,1);
                        LC$Token := mcb_simulator_pkg.Split( v_filebuffer, i , '|') ;
                        --Message('Row '||LC$Token);
                                  IF lfirst_char = '1' Then
                                  Null;
                                  Else
                                       Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (7777,'0022','The third line onward should start with 1');
                                       Forms_DDL('Commit');
                                       raise form_Trigger_failure;
                                  End if;
                        END LOOP;
                        --END IF;
                        END LOOP;
              EXCEPTION
                   When No_Data_Found Then
              TEXT_IO.fclose (v_handle);
              END;
    Exception
         When Others Then
         Message('Other error');
    END;
    I am calling the FUNCTION which you gave SPLIT as mcb_simulator_pkg.Split.

  • Reading a copy 'end-of-file' marker using TEXT_IO

    Hi
    I am using TEXT_IO to read a file, but the in the file there are special characters such as
    ,' ' which I think are "end of file marker" 1A hex, which 'COPY' adds to the end of and ascii copy.
    I'm using Oracle forms 6i, and when reading the above characters it raises unhandled exception ORA-01403, even though it hasn't reached the end of file.
    Can anyone help or advaise a way to avoid this problem?
    Thank You & Regards
    Begum

    One method is to save your data using the "write to spreadsheet file" vi, using whatever delimiter you choose (usually either comma ro tab char). This gives a file that can be opened with a text editor or Excel, and consists of rows of "numbers" seperated by the delimiter with an end of line char at the end of each row. When read back in using the "Read from Spreadsheet file", you can define how the values will be interpreted, either as numbers or as characters. The read data will be returned as a 2D array. This array can be indexed, either by autoindexing with loops, or by explicitly indexing to retrieve specific values (A[2,7]) and the returned values used however you wish.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Using Text_IO in Oracle Reports 6.0

    Hi.
    I ask again, perhaps someone can help me:
    I want to add a function to a column to write every row to a file (such as a .log-file).
    In Example i can simply write into a file like this:
    "Trigger - after parameter form":
    file_out Text_IO.File_type;
    BEGIN
    file_out:= Text_IO.Fopen('log.txt', 'w');
    Text_IO.put (file_out,'test');
    Text_IO.Fclose(file_out);
    END;
    But i want to write to this file from the function, placed in a column.
    So i cant open this file at every row (open, write, close)...
    Perhaps someone can tell me, how i can do this: To open a File before Report, write into the File from the function and close the file after the report.
    Thank you again.

    Hello,
    You need to create a client-side PL/SQL package as Program Units for your report. In this package you can define a package variable to hold and share your file handle, and create functions to open, write, and close the file. You can call these functions from the Before Report, Formula, and After Report triggers in your report.
    Regards,
    The Oracle Reports Team --skw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Text_IO in Oracle Reports 6.0 ?

    Hi all !
    I've build a Report with Report Builder 6.0.
    Now i want to write every row i get, in a file.
    So i want to use Text_IO. The Question is, how can i use a global (User) Variable with type "Text_IO.File_Type". I can only create a user variable with type "char, date, number".
    At the begin of Report i want to use the trigger "After parameter form" to open the file.
    Then i want to use a function where every row will be written to the file.
    At the end i want to close the file in trigger "after report"
    Perhaps someone can help me ?
    (Hope i had explained it easy, my english is not the best).
    Thank you.

    hello,
    you will have to create a package specifications that has the definition of this variable in it.
    you can than access the var using <packagename>.<varname> (e.g. myGlobals.myFile) from all PLSQL within your report (e.g. the after parameterform trigger).
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to use windows environment variable "%appdata%" in TEXT_IO built-in

    Hello Sir/Madam,
    I'm currently using TEXT_IO built-in package to write data file user's "C" drive in Oracle Forms 6i on Windows XP OS. We are in the process of upgrading the OS to Windows7. This new version does not allow to write to "C" or "D" drive. I was wondering how I can use windows environment variable "%appdata%" in this built-in to write the data file to user's AppData folder?
    I would appreciate your help.
    Regards,
    Vani Sonti

    You are obviously not familiar with the architecture of webforms. See here http://www.oracle.com/technetwork/developer-tools/forms/275632-133265.pdf
    I guess you are running your forms locally, so the forms server and the client run on the very same machine. This won't be the case once you run in production, as you will have an application server and clients connecting to the server.
    text_io, tool_env and all the forms built ins will be executed on the machine the forms runtime runs on, and in a 3 tier architecture this is the application server, not the client as the real client will run just a java applet which actually just does what the forms runtime on the server tells it to do (or passes client side events like mouse clicks to the forms runtime on the server).
    A very simple explanation for the architecture would be that the whole GUI part has been ripped off the forms runtime and put into a java applet; the logic part (the old-fashioned forms runtime) where the whole Forms PL/SQL code is executed communicates with the GUI part (which is implemented as a java applet) via HTTP, so there is no need to have both running on the very same machine.
    So if you are writing a file with text_io on c:\dummy.txt this file will be generated on the application server machine as it is executed where the forms runtime runs. If you read environment variables with tool_env.getvar you will get the environment variable from the application server machine.
    If you need those variables from your application server then those built-in packages are what you need, but if you need the real client variables there is no way around java in webforms 6i. But the beans should be simple enough to have them written within no time ;)
    cheers

Maybe you are looking for

  • Order change management in Sales order(MTO Scenario)

    Dear All, Iam trying to map OCm functionality.How is 'Initial object' created based on changes to the direct assignment of change numbers by using direct assignment.What exactly is this?I have a sales order of 10 pc. against which a prod. order is al

  • Non-existant vga display

    Hello. In my arrangement tab of display settings it shows my main monitor with a smaller VGA display off to one side. I don't have a second display and my desktop icons keep going over there so I have to get them with the finder. I reset nvram in ope

  • Photos from Lightroom print too dark

    I have saved my photos in RAW format and imported them into Lightroom. I have then made changes to them and exported them from Lightroom as JPEG files. However, when I go to a printing kiosk and get the photos printed, they are all darker than what t

  • Does Adobe Photoshop CS run with windows 7?

    does Adobe Photoshop CS run with windows 7?

  • Reporting too

    Is there any reporting tool available . Where i can create reports for oracle ?