GET_LINE or GET_LINES, how?

Hi,
I need to make stored procedure which will be called from SQLPlus and this procedure have to use input values to insert it into some table.
But i have problem. Next code simple doesn't work:
SQL> set serveroutput on
SQL> declare
  2  v_line varchar2(200);
  3  v_status number;
  4  begin
  5  dbms_output.get_line(v_line, v_status);
  6  dbms_output.put_line(v_line);
  7  end;
  8  /
PL/SQL procedure successfully completed.
Why?
I hope that this problem is already solved.
My idea is final procedure something like this:
create or replace procedure insert_txt is
  v_line   varchar2(200);
  v_line2 varchar2(200);
  v_status number;
begin
  dbms_output.put_line('Enter some text:');
  dbms_output.get_line(v_line, v_status);
  dbms_output.put_line('Enter another text:');
  dbms_output.get_line(v_line, v_status);
  dbms_output.get_line(v_line2, v_status);
  insert into txt_table values (v_line,v_line2);
end;
so i can call it from sqlplus:
set serveroutput on
begin
  insert_txt;
end;

Hi,
nenads wrote:
Hi,
I need to make stored procedure which will be called from SQLPlus and this procedure have to use input values to insert it into some table.
But i have problem. Next code simple doesn't work:
SQL> set serveroutput on
SQL> declare
  2  v_line varchar2(200);
  3  v_status number;
  4  begin
  5  dbms_output.get_line(v_line, v_status);
  6  dbms_output.put_line(v_line);
  7  end;
  8  /
PL/SQL procedure successfully completed.
Why?
I hope that this problem is already solved.
My idea is final procedure something like this:
create or replace procedure insert_txt is
  v_line   varchar2(200);
  v_line2 varchar2(200);
  v_status number;
begin
  dbms_output.put_line('Enter some text:');
  dbms_output.get_line(v_line, v_status);
  dbms_output.put_line('Enter another text:');
  dbms_output.get_line(v_line, v_status);
  dbms_output.get_line(v_line2, v_status);
  insert into txt_table values (v_line,v_line2);
end;
so i can call it from sqlplus:
set serveroutput on
begin
  insert_txt;
end;
Review what dbms_output.get_line does:
http://docs.oracle.com/database/121/ARPLS/d_output.htm#ARPLS67319
It retrieves a string previously stored by put_line.  If you haven't called put_line yet, then there won't be anything stored for you to retrieve.
What is the big picture here?  What business problem are you trying to solve?  If you can explain what you want to do in English, then someone can help you find a good way to do it in PL/SQL.

Similar Messages

  • Retrieve server msg from procedures located on other servers

    all works fine executing this:
    set serveroutput on;
    execute dbms_java.set_output(20000);
    execute JProg_Caller;
    Output Created By JProg_Caller:
    JProg_Caller's Message
    but when I am NOT Connected to the server where JProg_Caller is located on:
    executing this on another server:
    set serveroutput on;
    execute dbms_java.set_output(20000);
    execute JProg_Caller@ServerWhereJProg_CallerIsStored;
    I am not receiving any line, the Database link works fine and the JProg_Caller seem to do its job.
    How do I get the Lines provided by DBMS_OUTUT.put_line() ?

    Hello
    unfortunately the remote db is called like this:
    MY.OTHER.SERVER
    [email protected];
    and
    [email protected];
    function well,
    but
    [email protected] (ch_array,n );
    is causing:
    12/7 PL/SQL: Statement ignored
    12/7 PLS-00306: wrong number or types of arguments in call to
    'GET_LINES'
    DBMS_Output.get_lines@remote (ch_array,n );
    LINE/COL ERROR
    11/7 PL/SQL: Statement ignored
    11/7 PLS-00201: identifier 'DBMS_OUTPUT@REMOTE' must be declared
    11/7 PLS-00352: Unable to access another database 'REMOTE'
    o.k. because the Database remote does'nt exist.
    also
    DBMS_Output.get_lines@"MY.OTHER.SERVER" (ch_array,n );
    will cause
    12/7 PL/SQL: Statement ignored
    12/7 PLS-00306: wrong number or types of arguments in call to
    'GET_LINES'

  • DBMS_OUTPUT in Pro* C

    Can anyone suggest way of getting output of a dbms_out.put_line statement used inside a stored procedure called from a Pro*c program.
    I want that output to be available inside proc*c program.
    Thanks.

    DBMS_OUTPUT.GET_LINE/DBMS_OUTPUT.GET_LINES
    SY.

  • Send Mails to Multiple Users

    Hi,
    I have a requirement where I need to send mail to multiple users, for this I was following below link
    Re: Email to Multiple Email Address through WF
    Followed the above link and created 2 users with Notification Preference as MAILHTML and added to a role having email id as NULL and Notification Preference as MAILHTML . But I am not able to send mails rather it is going as notifications to the user Worklist.
    Please help me to resolve this issue.
    Regards,
    Prateek

    Hi, Andy,
    Use the Oracle-supplied package utl_mail for sending email messages:
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_mail.htm#i1001258
    It would be easier if you did not use dbms_output, or, if you really wanted to, do not call it directly. Write your own procedure (let's call it add_to_message) that concatenates a string to the end of a message that will ultimately be sent as an email. If you want to display the string using dbms_ouptut.put line as well as append it to the message, then call dbms_ouptut.put line inside add_to_message.
    If you really must get the text from dbms_output, use dbms_output.get_line (or get_lines)
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_output.htm#i999346

  • Use of DBMS_OUTPUT.GET_LINE to debug triggers

    I states in the PL/SQL Users Guide and Reference (page 9-16):
    "Package DBMS_OUTPUT enables you to display output from PL/SQL blocks and subprograms, which makes it easier to test and debug them. The procedure put_line outputs information to a buffer in the SGA. You display the information Overview of Product-Specific Packages by calling the procedure get_line or by setting SERVEROUTPUT ON in SQL*Plus."
    Also in Supplied PL/SQL Packages and Types Reference it states:
    "A trigger might want to print out some debugging information. To do this, the trigger would do:
    DBMS_OUTPUT.PUT_LINE(I got here:||:new.col|| is the new value);
    If you have enabled the DBMS_OUTPUT package, then this PUT_LINE would be buffered, and you could, after executing the statement (presumably some INSERT, DELETE, or UPDATE that caused the trigger to fire), get the line of information back.
    For example:
    BEGIN
    DBMS_OUTPUT.GET_LINE(:buffer, :status);
    END;
    It could then display the buffer on the screen. You repeat calls to GET_LINE until status comes back as nonzero. For better performance, you should use calls to GET_LINES which can return an array of lines."
    I have tried to use this, but cannot get anything out. I do not find any actual examples in any of the docs on how to use this.
    Jim Azeltine
    [email protected]

    With SET SERVEROUTPUT ON, it causes the usage of DBMS_OUPUT.PUT_LINE to display automatically. With SET SERVEROUPUT OFF, you have to use DBMS_OUPUT.ENABLE to allow things from DBMS_OUTPUT.PUT_LINE to be stored to a buffer and DBMS_OUTPUT.GET_LINE or DBMS_OUTPUT.GET_LINES to retrieve the items from the buffer into variables and use PRINT or SET AUTOPRINT ON or something to display them. I have always just used SET SERVEROUTPUT ON, however I imagine the other method might be useful under certain circumstances where you want to store the values to variables or enter the values into audit tables or something other than just display them directly to the screen. There are also many environments where SET SERVEROUTPUT ON cannot be used, since it is a SQL*Plus command. Below I have given, first, an example of usage of SET SERVEROUTPUT ON, then, second, an example with SET SERVEROUTPUT OFF, that uses DBMS_OUTPUT.ENABLE and DBMS_OUTPUT.GET_LINE and SET AUTOPRINT ON.
    SQL> SET ECHO ON
    SQL> -- trigger for demonstration:
    SQL> CREATE OR REPLACE TRIGGER test_trigger
      2    BEFORE INSERT ON anytable
      3    FOR EACH ROW
      4  BEGIN
      5    DBMS_OUTPUT.PUT_LINE ('I got here: '
      6                          || :NEW.anycolumn
      7                          || ' is the new value.');
      8    :NEW.anycolumn := 0;
      9    DBMS_OUTPUT.PUT_LINE ('I got here: '
    10                          || :NEW.anycolumn
    11                          || ' is the new value.');
    12  END test_trigger;
    13  /
    Trigger created.
    SQL>
    SQL>
    SQL> -- example with serverouput on
    SQL> SET SERVEROUTPUT ON
    SQL> INSERT INTO anytable VALUES (1)
      2  /
    I got here: 1 is the new value.
    I got here: 0 is the new value.
    1 row created.
    SQL>
    SQL>
    SQL> -- example with serveroutput off:
    SQL> SET SERVEROUTPUT OFF
    SQL> EXECUTE DBMS_OUTPUT.ENABLE (40)
    PL/SQL procedure successfully completed.
    SQL> INSERT INTO anytable VALUES (1)
      2  /
    1 row created.
    SQL> VARIABLE buffer VARCHAR2 (40)
    SQL> VARIABLE status NUMBER
    SQL> SET AUTOPRINT ON
    SQL> BEGIN
      2    DBMS_OUTPUT.GET_LINE(:buffer, :status);
      3  END;
      4  /
    PL/SQL procedure successfully completed.
        STATUS
             0
    BUFFER
    I got here: 1 is the new value.
    SQL> BEGIN
      2    DBMS_OUTPUT.GET_LINE(:buffer, :status);
      3  END;
      4  /
    PL/SQL procedure successfully completed.
        STATUS
             0
    BUFFER
    I got here: 0 is the new value.
    SQL> BEGIN
      2    DBMS_OUTPUT.GET_LINE(:buffer, :status);
      3  END;
      4  /
    PL/SQL procedure successfully completed.
        STATUS
             1
    BUFFER
    SQL>

  • UTL_FILE.get_line won't read large files ?

    I am trying to read a large fixed length flat file. If I cut the file down to really small it will read it but it reads it as a single line. If I try to read a larger file > 32k I get a READ_ERROR. I am pretty sure it has to do with the end of line marker but I saw nothing about that in the UTL_FILE documentation. This is on UNIX, new line character after each record in the file. Standard unix flat file.
    Any ideas on what to do?
    Thanks in advance
    Matt
    [email protected]
    my code:
    BEGIN
    BEGIN
    std_file := UTL_FILE.FOPEN('&4','&1','r',32767);
    EXCEPTION
    WHEN UTL_FILE.INVALID_PATH THEN
    RAISE_APPLICATION_ERROR(-20011,'Invalid Path for STD file, &4/&1');
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20014,'Other Error trying to open STD file, &4/&1');
    END;
    IF UTL_FILE.is_open(std_file) = FALSE THEN
    RAISE_APPLICATION_ERROR(-20015,'Could not open STD file, &4/&1');
    END IF;
    -- READ STD FILE HEADER
    BEGIN
    UTL_FILE.get_line(std_file,hdr_text);
    EXCEPTION
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    RAISE_APPLICATION_ERROR(-20017,'STD read file handle not valid');
    WHEN UTL_FILE.INVALID_OPERATION THEN
    RAISE_APPLICATION_ERROR(-20018,'STD read invalid operation error');
    WHEN UTL_FILE.READ_ERROR THEN
    RAISE_APPLICATION_ERROR(-20019,'STD read error');
    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-20020,'STD read no data found');
    WHEN VALUE_ERROR THEN
    RAISE_APPLICATION_ERROR(-20021,'STD read value error');
    END;
    -- PROCESS TRANSACTIONS
    LOOP
    BEGIN
    tran_text := NULL;
    UTL_FILE.get_line(std_file,tran_text);
    EXCEPTION
    WHEN no_data_found THEN EXIT; -- EOF
    WHEN value_error THEN
    RAISE_APPLICATION_ERROR(-20010,'STD record too long.');
    END;
    std_rowcount := std_rowcount + 1;
    END LOOP;
    UTL_FILE.FCLOSE(std_file);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-20001,'No Data Found.');
    WHEN UTL_FILE.INVALID_PATH THEN
    RAISE_APPLICATION_ERROR(-20002,'Invalid Path ');
    WHEN UTL_FILE.INVALID_MODE THEN
    RAISE_APPLICATION_ERROR(-20003,'Invalid Mode ');
    WHEN UTL_FILE.INVALID_OPERATION THEN
    RAISE_APPLICATION_ERROR(-20004,'Invalid Operation ');
    END;
    null

    We are still hung up on this. I tried implementing the code from STEVE'S XML book but still haven't resovled it.
    The clob is being created via XSU see below. The new char[8192] appeasr to force the output file to 8K
    with trailing characters on small clobs but adds a carraige return each 8K on larger ones.
    As usual any input is appreciated from all. Doese anyone know of a good JAVA forum like this one?
    Thanks
    PROCEDURE BuildXml(v_return OUT INTEGER, v_message OUT VARCHAR2,string_in VARCHAR2,xml_CLOB OUT NOCOPY CLOB) IS
    queryCtx DBMS_XMLquery.ctxType;
    Buffer RAW(1024);
    Amount BINARY_INTEGER := 1024;
    Position INTEGER := 1;
    sql_string     VARCHAR2(2000) := string_in;
    BEGIN
    v_return := 1;
    v_message := 'BuildXml completed succesfully.';
    queryCtx := DBMS_XMLQuery.newContext(sql_string);
    xml_CLOB := DBMS_XMLQuery.getXML(queryCtx);
    DBMS_XMLQuery.closeContext(queryCtx);
    EXCEPTION WHEN OTHERS THEN
    v_return := 0;
    v_message := 'BuildXml failed - '||SQLERRM;
    END BuildXml;
    create or replace and compile java source named sjs.write_CLOB as
    import java.io.*;
    import java.sql.*;
    import java.math.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    public class write_CLOB extends Object
    public static void pass_str_array(oracle.sql.CLOB p_in,java.lang.String f_in)
    throws java.sql.SQLException, IOException
    File target = new File(f_in);
    FileWriter fw = new FileWriter(target);
    BufferedWriter out = new BufferedWriter(fw);
    Reader is = p_in.getCharacterStream();
    char buffer[] = new char[8192];
    int length;
    while( (length=is.read(buffer)) != -1) {
    out.write(buffer);
    is.close();
    fw.close();
    /

  • Using client_text_io.get_line to get file created date...

    client_text_io.get_line is getting file modified date, is there any way to get the file created date instead?
    Thanks,
    Jess

    Ha-ha, you're r't, thanks for clearing my head, don't know what I'm thinking. The thing I'm looking for should be dos cmd dir to get the file created date instead of modified date.
    Thanks again
    Jess

  • Inconsistent Results from dbms_output.get_lines

    Hi,
    I am getting inconsistent results from using dbms_output.get_lines.
    I'm using get_lines in a procedure A that executes a function B to test if the function returns 0 or > 0 to indicate validity of my data. In that function, I use dbms_output.put_lines to communicate data points that I want to use. My procedure A does a get_lines after executing function B then either logs the lines into a table or sends an email.
    Right now, get_lines is behaving sporadically for me. Sometimes I the chararr returns some lines while other times it doesn't. The strange thing is numlines does return a value, and it's the value that I expected.
    Can someone please help?
    Thanks.

    Use parameters or even global package variables to transport data from one procedure to the other. dbms_output is not meant for this, it will not work.

  • Use client_text_io.get_line to get file created date...

    client_text_io.get_line is getting file modified date, is there any way to get the file created date instead?
    thanks,
    Jess

    This is a Forms webutil question. You would be better off asking this question in the Forms proper, not least becaus emembers of the Forms team who actually worked on webutil (Duncan Mills, Frank Nimphius) often answer questions there.
    Cheers, APC

  • Problem while reading file using UTL_FILE.get_line

    Hi All,
    I am having the following txt file with the following data.
    1|2010-09-25T02:00:24+09:00
    2|ProductCode|SerialNumber|OpcoID|IssueDate|AcceptDate|FinishingUsageCounter.FoldZ|FinishingUsageCounter.FoldLetterZ|FinishingUsageCounter.FoldLetterC|FinishingUsageCounter.FoldCenter|FinishingUsageCounter.Punch2|FinishingUsageCounter.Punch3|FinishingUsageCounter.Punch4|FinishingUsageCounter.StapleSingle|FinishingUsageCounter.StapleDual|FinishingUsageCounter.StapleQuad|FinishingUsageCounter.BindBook|FinishingUsageCounter.CoilPunch|FinishingUsageCounter.Trimming|FinishingUsageCounter.SquareFold|FAXUsageCounter.SendCount|FAXUsageCounter.SendImpressions|FAXUsageCounter.ReceivedCount0|FAXUsageCounter.ReceivedCount1|FAXUsageCounter.ReceivedCount2|FAXUsageCounter.ReceivedCount3|FAXUsageCounter.ReceivedCount4|FAXUsageCounter.ReceivedCount5|FAXUsageCounter.ReceivedImpressions0|FAXUsageCounter.ReceivedImpressions1|FAXUsageCounter.ReceivedImpressions2|FAXUsageCounter.ReceivedImpressions3|FAXUsageCounter.ReceivedImpressions4|FAXUsageCounter.ReceivedImpressions5|FAXUsageCounter.PrintImpressions0|FAXUsageCounter.PrintImpressions1|FAXUsageCounter.PrintImpressions2|FAXUsageCounter.PrintImpressions3|FAXUsageCounter.PrintImpressions4|FAXUsageCounter.PrintImpressions5|FAXUsageCounter.StoreForPollingPrintImpressions|FAXUsageCounter.PrintSheets0|FAXUsageCounter.PrintSheets1|FAXUsageCounter.PrintSheets2|FAXUsageCounter.PrintSheets3|FAXUsageCounter.PrintSheets4|FAXUsageCounter.PrintSheets5|FAXUsageCounter.StoreForPollingPrintSheets|FAXUsageCounter.PrintDuplexSheets0|FAXUsageCounter.PrintDuplexSheets1|FAXUsageCounter.PrintDuplexSheets2|FAXUsageCounter.PrintDuplexSheets3|FAXUsageCounter.PrintDuplexSheets4|FAXUsageCounter.PrintDuplexSheets5|FAXUsageCounter.StoreForPollingPrintDuplexSheets|FAXUsageCounter.PrintReverseSheets0|FAXUsageCounter.PrintReverseSheets1|FAXUsageCounter.PrintReverseSheets2|FAXUsageCounter.PrintReverseSheets3|FAXUsageCounter.PrintReverseSheets4|FAXUsageCounter.PrintReverseSheets5|FAXUsageCounter.StoreForPollingPrintReverseSheets|FAXUsageCounter.PrintLargeSheets0|FAXUsageCounter.PrintLargeSheets1|FAXUsageCounter.PrintLargeSheets2|FAXUsageCounter.PrintLargeSheets3|FAXUsageCounter.PrintLargeSheets4|FAXUsageCounter.PrintLargeSheets5|IFAXUsageCounter.SendCount|IFAXUsageCounter.SendImpressions|IFAXUsageCounter.ReceivedCount|IFAXUsageCounter.ReceivedImpressions|IFAXUsageCounter.PrintImpressions|IFAXUsageCounter.PrintSheets|IFAXUsageCounter.PrintDuplexSheets|IFAXUsageCounter.PrintReverseSheets|IFAXUsageCounter.PrintLargeSheets|DirectFAXUsageCounter.SendCount|DirectFAXUsageCounter.SendImpressions|ServerFAXUsageCounter.SendCount|ServerFAXUsageCounter.SendImpressions|ScanUsageCounter.BWImpressions|ScanUsageCounter.ColorImpressions|ScanUsageCounter.MailboxBWImpressions|ScanUsageCounter.MailboxColorImpressions|ScanUsageCounter.FileBWImpressions|ScanUsageCounter.FileColorImpressions|ScanUsageCounter.EMailBWImpressions|ScanUsageCounter.EMailColorImpressions|ScanUsageCounter.MediaBWImpressions|ScanUsageCounter.MediaColorImpressions|PrintUsageCounter.BWImpressions|PrintUsageCounter.ColorImpressions|PrintUsageCounter.BW2upImpressions|PrintUsageCounter.Color2upImpressions|PrintUsageCounter.BWNupImpressions|PrintUsageCounter.ColorNupImpressions|PrintUsageCounter.BWSheets|PrintUsageCounter.ColorSheets|PrintUsageCounter.BWDuplexSheets|PrintUsageCounter.ColorDuplexSheets|PrintUsageCounter.BWReverseSheets|PrintUsageCounter.ColorReverseSheets|PrintUsageCounter.BWLargeSheets|PrintUsageCounter.ColorLargeSheets|DiagPrintUsageCounter.BWImpressions|DiagPrintUsageCounter.ColorImpressions|DiagPrintUsageCounter.BWSheets|DiagPrintUsageCounter.ColorSheets|DiagPrintUsageCounter.BWLargeSheets|DiagPrintUsageCounter.ColorLargeSheets|CopyUsageCounter.BWImpressions|CopyUsageCounter.ColorImpressions|CopyUsageCounter.BW2upImpressions|CopyUsageCounter.Color2upImpressions|CopyUsageCounter.BWNupImpressions|CopyUsageCounter.ColorNupImpressions|CopyUsageCounter.BWSheets|CopyUsageCounter.ColorSheets|CopyUsageCounter.BWDuplexSheets|CopyUsageCounter.ColorDuplexSheets|CopyUsageCounter.BWReverseSheets|CopyUsageCounter.ColorReverseSheets|CopyUsageCounter.BWLargeSheets|CopyUsageCounter.ColorLargeSheets|ReportUsageCounter.BWImpressions|ReportUsageCounter.ColorImpressions|ReportUsageCounter.BWSheets|ReportUsageCounter.ColorSheets|ReportUsageCounter.BWDuplexSheets|ReportUsageCounter.ColorDuplexSheets|ReportUsageCounter.BWReverseSheets|ReportUsageCounter.ColorReverseSheets|ReportUsageCounter.BWLargeSheets|ReportUsageCounter.ColorLargeSheets|LargeSizeUsageCounter.BWImpressions|LargeSizeUsageCounter.ColorImpressions|PaperSizeUsageCounter.A4|PaperSizeUsageCounter.UNSPECIFIED|FAXUsageCounter.SendCount0|FAXUsageCounter.SendCount1|FAXUsageCounter.SendCount2|FAXUsageCounter.SendCount3|FAXUsageCounter.SendCount4|FAXUsageCounter.SendCount5|FAXUsageCounter.SendImpressions0|FAXUsageCounter.SendImpressions1|FAXUsageCounter.SendImpressions2|FAXUsageCounter.SendImpressions3|FAXUsageCounter.SendImpressions4|FAXUsageCounter.SendImpressions5|FAXUsageCounter.PrintBW2upImpressions|FAXUsageCounter.BW1ImpressionJob|FAXUsageCounter.BW2ImpressionsJob|FAXUsageCounter.BW3ImpressionsJob|FAXUsageCounter.BW4ImpressionsJob|FAXUsageCounter.BW5ImpressionsJob|FAXUsageCounter.BW6ImpressionsJob|FAXUsageCounter.BW7ImpressionsJob|FAXUsageCounter.BW8ImpressionsJob|FAXUsageCounter.BW9ImpressionsJob|FAXUsageCounter.BW10To19ImpressionsJob|FAXUsageCounter.BW20To29ImpressionsJob|FAXUsageCounter.BW30To49ImpressionsJob|FAXUsageCounter.BW50To74ImpressionsJob|FAXUsageCounter.BW75To99ImpressionsJob|FAXUsageCounter.BW100To249ImpressionsJob|FAXUsageCounter.BWOver250ImpressionsJob|FAXUsageCounter.TotalTimeSent0|FAXUsageCounter.TotalTimeSent1|FAXUsageCounter.TotalTimeSent2|FAXUsageCounter.TotalTimeSent3|FAXUsageCounter.TotalTimeSent4|FAXUsageCounter.TotalTimeSent5|FAXUsageCounter.TotalTimeReceived0|FAXUsageCounter.TotalTimeReceived1|FAXUsageCounter.TotalTimeReceived2|FAXUsageCounter.TotalTimeReceived3|FAXUsageCounter.TotalTimeReceived4|FAXUsageCounter.TotalTimeReceived5|IFAXUsageCounter.Print2upImpressions|IFAXUsageCounter.BW1ImpressionJob|IFAXUsageCounter.BW2ImpressionsJob|IFAXUsageCounter.BW3ImpressionsJob|IFAXUsageCounter.BW4ImpressionsJob|IFAXUsageCounter.BW5ImpressionsJob|IFAXUsageCounter.BW6ImpressionsJob|IFAXUsageCounter.BW7ImpressionsJob|IFAXUsageCounter.BW8ImpressionsJob|IFAXUsageCounter.BW9ImpressionsJob|IFAXUsageCounter.BW10To19ImpressionsJob|IFAXUsageCounter.BW20To29ImpressionsJob|IFAXUsageCounter.BW30To49ImpressionsJob|IFAXUsageCounter.BW50To74ImpressionsJob|IFAXUsageCounter.BW75To99ImpressionsJob|IFAXUsageCounter.BW100To249ImpressionsJob|IFAXUsageCounter.BWOver250ImpressionsJob|DirectFAXUsageCounter.SendCount0|DirectFAXUsageCounter.SendCount1|DirectFAXUsageCounter.SendCount2|DirectFAXUsageCounter.SendCount3|DirectFAXUsageCounter.SendCount4|DirectFAXUsageCounter.SendCount5|DirectFAXUsageCounter.SendImpressions0|DirectFAXUsageCounter.SendImpressions1|DirectFAXUsageCounter.SendImpressions2|DirectFAXUsageCounter.SendImpressions3|DirectFAXUsageCounter.SendImpressions4|DirectFAXUsageCounter.SendImpressions5|PrintUsageCounter.BW2upSimplexImpressions|PrintUsageCounter.Color2upSimplexImpressions|PrintUsageCounter.BW2upDuplexImpressions|PrintUsageCounter.Color2upDuplexImpressions|PrintUsageCounter.BW4upSimplexImpressions|PrintUsageCounter.Color4upSimplexImpressions|PrintUsageCounter.BW4upDuplexImpressions|PrintUsageCounter.Color4upDuplexImpressions|PrintUsageCounter.BWNupSimplexImpressions|PrintUsageCounter.ColorNupSimplexImpressions|PrintUsageCounter.BWNupDuplexImpressions|PrintUsageCounter.ColorNupDuplexImpressions|PrintUsageCounter.BW1ImpressionJob|PrintUsageCounter.BW2ImpressionsJob|PrintUsageCounter.BW3ImpressionsJob|PrintUsageCounter.BW4ImpressionsJob|PrintUsageCounter.BW5ImpressionsJob|PrintUsageCounter.BW6ImpressionsJob|PrintUsageCounter.BW7ImpressionsJob|PrintUsageCounter.BW8ImpressionsJob|PrintUsageCounter.BW9ImpressionsJob|PrintUsageCounter.BW10To19ImpressionsJob|PrintUsageCounter.BW20To29ImpressionsJob|PrintUsageCounter.BW30To49ImpressionsJob|PrintUsageCounter.BW50To74ImpressionsJob|PrintUsageCounter.BW75To99ImpressionsJob|PrintUsageCounter.BW100To249ImpressionsJob|PrintUsageCounter.BWOver250ImpressionsJob|PrintUsageCounter.Color1ImpressionJob|PrintUsageCounter.Color2ImpressionsJob|PrintUsageCounter.Color3ImpressionsJob|PrintUsageCounter.Color4ImpressionsJob|PrintUsageCounter.Color5ImpressionsJob|PrintUsageCounter.Color6ImpressionsJob|PrintUsageCounter.Color7ImpressionsJob|PrintUsageCounter.Color8ImpressionsJob|PrintUsageCounter.Color9ImpressionsJob|PrintUsageCounter.Color10To19ImpressionsJob|PrintUsageCounter.Color20To29ImpressionsJob|PrintUsageCounter.Color30To49ImpressionsJob|PrintUsageCounter.Color50To74ImpressionsJob|PrintUsageCounter.Color75To99ImpressionsJob|PrintUsageCounter.Color100To249ImpressionsJob|PrintUsageCounter.ColorOver250ImpressionsJob|CopyUsageCounter.BW2upSimplexImpressions|CopyUsageCounter.Color2upSimplexImpressions|CopyUsageCounter.BW2upDuplexImpressions|CopyUsageCounter.Color2upDuplexImpressions|CopyUsageCounter.BW4upSimplexImpressions|CopyUsageCounter.Color4upSimplexImpressions|CopyUsageCounter.BW4upDuplexImpressions|CopyUsageCounter.Color4upDuplexImpressions|CopyUsageCounter.BWNupSimplexImpressions|CopyUsageCounter.ColorNupSimplexImpressions|CopyUsageCounter.BWNupDuplexImpressions|CopyUsageCounter.ColorNupDuplexImpressions|CopyUsageCounter.BWSimplexToDuplexSheets|CopyUsageCounter.ColorSimplexToDuplexSheets|CopyUsageCounter.BWDuplexToDuplexSheets|CopyUsageCounter.ColorDuplexToDuplexSheets|CopyUsageCounter.BWSimplexToSimplexSheets|CopyUsageCounter.ColorSimplexToSimplexSheets|CopyUsageCounter.BWDuplexToSimplexSheets|CopyUsageCounter.ColorDuplexToSimplexSheets|CopyUsageCounter.BW1ImpressionJob|CopyUsageCounter.BW2ImpressionsJob|CopyUsageCounter.BW3ImpressionsJob|CopyUsageCounter.BW4ImpressionsJob|CopyUsageCounter.BW5ImpressionsJob|CopyUsageCounter.BW6ImpressionsJob|CopyUsageCounter.BW7ImpressionsJob|CopyUsageCounter.BW8ImpressionsJob|CopyUsageCounter.BW9ImpressionsJob|CopyUsageCounter.BW10To19ImpressionsJob|CopyUsageCounter.BW20To29ImpressionsJob|CopyUsageCounter.BW30To49ImpressionsJob|CopyUsageCounter.BW50To74ImpressionsJob|CopyUsageCounter.BW75To99ImpressionsJob|CopyUsageCounter.BW100To249ImpressionsJob|CopyUsageCounter.BWOver250ImpressionsJob|CopyUsageCounter.Color1ImpressionJob|CopyUsageCounter.Color2ImpressionsJob|CopyUsageCounter.Color3ImpressionsJob|CopyUsageCounter.Color4ImpressionsJob|CopyUsageCounter.Color5ImpressionsJob|CopyUsageCounter.Color6ImpressionsJob|CopyUsageCounter.Color7ImpressionsJob|CopyUsageCounter.Color8ImpressionsJob|CopyUsageCounter.Color9ImpressionsJob|CopyUsageCounter.Color10To19ImpressionsJob|CopyUsageCounter.Color20To29ImpressionsJob|CopyUsageCounter.Color30To49ImpressionsJob|CopyUsageCounter.Color50To74ImpressionsJob|CopyUsageCounter.Color75To99ImpressionsJob|CopyUsageCounter.Color100To249ImpressionsJob|CopyUsageCounter.ColorOver250ImpressionsJob|CopyUsageCounter.BW1OriginalJob|CopyUsageCounter.BW2OriginalsJob|CopyUsageCounter.BW3OriginalsJob|CopyUsageCounter.BW4OriginalsJob|CopyUsageCounter.BW5OriginalsJob|CopyUsageCounter.BW6OriginalsJob|CopyUsageCounter.BW7OriginalsJob|CopyUsageCounter.BW8OriginalsJob|CopyUsageCounter.BW9OriginalsJob|CopyUsageCounter.BW10To19OriginalsJob|CopyUsageCounter.BW20To29OriginalsJob|CopyUsageCounter.BW30To49OriginalsJob|CopyUsageCounter.BW50To74OriginalsJob|CopyUsageCounter.BW75To99OriginalsJob|CopyUsageCounter.BW100To249OriginalsJob|CopyUsageCounter.BWOver250OriginalsJob|CopyUsageCounter.Color1OriginalJob|CopyUsageCounter.Color2OriginalsJob|CopyUsageCounter.Color3OriginalsJob|CopyUsageCounter.Color4OriginalsJob|CopyUsageCounter.Color5OriginalsJob|CopyUsageCounter.Color6OriginalsJob|CopyUsageCounter.Color7OriginalsJob|CopyUsageCounter.Color8OriginalsJob|CopyUsageCounter.Color9OriginalsJob|CopyUsageCounter.Color10To19OriginalsJob|CopyUsageCounter.Color20To29OriginalsJob|CopyUsageCounter.Color30To49OriginalsJob|CopyUsageCounter.Color50To74OriginalsJob|CopyUsageCounter.Color75To99OriginalsJob|CopyUsageCounter.Color100To249OriginalsJob|CopyUsageCounter.ColorOver250OriginalsJob|PaperSizeUsageCounter.A3|PaperTrayUsageCounter.Tray1PrintedSheets|PaperTrayUsageCounter.Tray2PrintedSheets|PaperTrayUsageCounter.Tray3PrintedSheets|PaperTrayUsageCounter.Tray4PrintedSheets|PaperTrayUsageCounter.Tray5PrintedSheets|PaperTrayUsageCounter.Tray6PrintedSheets|PaperTrayUsageCounter.Tray7PrintedSheets|PaperTrayUsageCounter.Tray8PrintedSheets|PaperTrayUsageCounter.Tray1PrintedImpressions|PaperTrayUsageCounter.Tray2PrintedImpressions|PaperTrayUsageCounter.Tray3PrintedImpressions|PaperTrayUsageCounter.Tray4PrintedImpressions|PaperTrayUsageCounter.Tray5PrintedImpressions|PaperTrayUsageCounter.Tray6PrintedImpressions|PaperTrayUsageCounter.Tray7PrintedImpressions|PaperTrayUsageCounter.Tray8PrintedImpressions|StoredDocumentUsageCounter.UnprintedDeletedImpressions|UptimeUsageCounter.WarmUpTime|UptimeUsageCounter.IOTRunTime|UptimeUsageCounter.IITRunTime|UptimeUsageCounter.LowPowerTime|UptimeUsageCounter.SleepTime|UptimeUsageCounter.StandbyTime|UptimeUsageCounter.PowerOffTime
    3|ABCDEF|110139|ABC|2010-09-24T12:32:00+09:00|2010-09-24T12:32:28+09:00|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||0|0|0|0|0|0|0|0|0|0|0|0|0|309|159|158|16|0|0|151|129|0|0|4709|2105|1971|704|2|0|2760|1407|1877|769|0|0|47|86|0|0|0|0|0|0|305|21|1|0|0|0|204|18|101|3|0|0|1|1|60|0|51|0|9|0|0|0|0|0|77|92|4309|0|0|5|0|0|0|0|0|19|0|0|0|0|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|355|0|0|0|0|0|319|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|21|10|1950|694|0|0|2|0|0|0|2|0|422|292|60|38|24|18|18|26|8|60|34|20|3|0|0|0|233|138|36|30|10|20|9|11|7|27|17|6|2|1|0|0|1|0|0|0|0|0|0|0|0|0|0|0|5|1|96|2|103|15|0|0|84|7|0|4|1|0|0|0|0|0|1|0|0|0|1|0|13|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|80|12|0|3|1|0|0|0|0|1|0|0|1|0|0|0|14|3|0|0|0|0|0|0|0|0|0|0|0|0|0|0|135|3631|658|11|135|9|0|0|0|5901|1114|11|169|9|0|0|0|0|66|513|29|5715|102714|11941|28
    3|ABCDEF|110139|ABC|2010-09-24T13:34:00+09:00|2010-09-24T13:34:16+09:00|0|0|0|0|0|0|0|0|0|0|0|0|0|0|5|19|0|6|0|0|0|0|0|4|0|0|0|0|0|4|0|0|0|0|0|0|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|309|159|158|16|0|0|151|129|0|0|4709|2105|1971|704|2|0|2760|1407|1877|769|0|0|47|86|0|0|0|0|0|0|305|21|1|0|0|0|204|18|101|3|0|0|1|1|60|0|51|0|9|0|0|0|0|0|77|92|4309|0|0|5|0|0|0|0|0|19|0|0|0|0|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|355|0|0|0|0|0|319|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|21|10|1950|694|0|0|2|0|0|0|2|0|422|292|60|38|24|18|18|26|8|60|34|20|3|0|0|0|233|138|36|30|10|20|9|11|7|27|17|6|2|1|0|0|1|0|0|0|0|0|0|0|0|0|0|0|5|1|96|2|103|15|0|0|84|7|0|4|1|0|0|0|0|0|1|0|0|0|1|0|13|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|80|12|0|3|1|0|0|0|0|1|0|0|1|0|0|0|14|3|0|0|0|0|0|0|0|0|0|0|0|0|0|0|135|3631|658|11|135|9|0|0|0|5901|1114|11|169|9|0|0|0|0|66|513|29|5730|102741|11960|28
    4|2010-09-25T02:00:24+09:00|2
    Following is the code i am using to read the file contents.
    DECLARE
    v_file_in UTL_FILE.file_type;
    v_str VARCHAR2 (32767);
    po_error_txt VARCHAR2 (2000) := 0;
    po_success boolean;
    BEGIN
    v_file_in := UTL_FILE.fopen ('GB_EPINDIR', 'USAGECOUNTER20100925020020.txt', 'R');
    LOOP
    BEGIN
    UTL_FILE.get_line (v_file_in, v_str,32767);
    dbms_output.put_line(v_str);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    WHEN OTHERS THEN
    po_error_txt := SUBSTR (SQLERRM, 1, 500);
    po_success := FALSE;
    EXIT;
    END;
    END LOOP;
    END;
    When loop comes on 2|ProductCode|Serial................... its through the error.
    Please help me to resolve this problem.
    Thanks & Regards
    Uzair Hasan Nizami
    Edited by: Uzair Hasan Nizami on Oct 5, 2010 1:44 PM

    Uzair Hasan Nizami wrote:
    See You have changed the second line. I mean you have split the line in two parts.No, I did not. Used exactly as you posted. To prove I added line number display:
    SQL> DECLARE
      2  v_file_in UTL_FILE.file_type;
      3  v_str VARCHAR2 (32767);
      4  po_error_txt VARCHAR2 (2000) := 0;
      5  po_success boolean;
      6  v_line_num number := 0;
      7  BEGIN
      8  v_file_in := UTL_FILE.fopen ('GB_EPINDIR', 'USAGECOUNTER20100925020020.txt', 'R',32767);
      9  LOOP
    10  BEGIN
    11  v_line_num := v_line_num + 1;
    12  UTL_FILE.get_line (v_file_in, v_str,32767);
    13  dbms_output.put_line('============= Line ' || v_line_num || ' =================');
    14  dbms_output.put_line(v_str);
    15  EXCEPTION
    16  WHEN NO_DATA_FOUND THEN
    17  EXIT;
    18  WHEN OTHERS THEN
    19  po_error_txt := SUBSTR (SQLERRM, 1, 500);
    20  po_success := FALSE;
    21  dbms_output.put_line(po_error_txt);
    22  EXIT;
    23  END;
    24  END LOOP;
    25  IF UTL_FILE.IS_OPEN(v_file_in) THEN UTL_FILE.FCLOSE(v_file_in); END IF;
    26  END;
    27  /
    ============= Line 1 =================
    1|2010-09-25T02:00:24+09:00
    ============= Line 2 =================
    2|ProductCode|SerialNumber|OpcoID|IssueDate|AcceptDate|FinishingUsageCounter.Fol
    dZ|FinishingUsageCounter.FoldLetterZ|FinishingUsageCounter.FoldLetterC|Finishing
    UsageCounter.FoldCenter|FinishingUsageCounter.Punch2|FinishingUsageCounter.Punch
    3|FinishingUsageCounter.Punch4|FinishingUsageCounter.StapleSingle|FinishingUsage
    Counter.StapleDual|FinishingUsageCounter.StapleQuad|FinishingUsageCounter.BindBo
    ok|FinishingUsageCounter.CoilPunch|FinishingUsageCounter.Trimming|FinishingUsage
    Counter.SquareFold|FAXUsageCounter.SendCount|FAXUsageCounter.SendImpressions|FAX
    UsageCounter.ReceivedCount0|FAXUsageCounter.ReceivedCount1|FAXUsageCounter.Recei
    vedCount2|FAXUsageCounter.ReceivedCount3|FAXUsageCounter.ReceivedCount4|FAXUsage
    Counter.ReceivedCount5|FAXUsageCounter.ReceivedImpressions0|FAXUsageCounter.Rece
    ivedImpressions1|FAXUsageCounter.ReceivedImpressions2|FAXUsageCounter.ReceivedIm
    pressions3|FAXUsageCounter.ReceivedImpressions4|FAXUsageCounter.ReceivedImpressi
    ons5|FAXUsageCounter.PrintImpressions0|FAXUsageCounter.PrintImpressions1|FAXUsag
    eCounter.PrintImpressions2|FAXUsageCounter.PrintImpressions3|FAXUsageCounter.Pri
    ntImpressions4|FAXUsageCounter.PrintImpressions5|FAXUsageCounter.StoreForPolling
    PrintImpressions|FAXUsageCounter.PrintSheets0|FAXUsageCounter.PrintSheets1|FAXUs
    ageCounter.PrintSheets2|FAXUsageCounter.PrintSheets3|FAXUsageCounter.PrintSheets
    4|FAXUsageCounter.PrintSheets5|FAXUsageCounter.StoreForPollingPrintSheets|FAXUsa
    geCounter.PrintDuplexSheets0|FAXUsageCounter.PrintDuplexSheets1|FAXUsageCounter.
    PrintDuplexSheets2|FAXUsageCounter.PrintDuplexSheets3|FAXUsageCounter.PrintDuple
    xSheets4|FAXUsageCounter.PrintDuplexSheets5|FAXUsageCounter.StoreForPollingPrint
    DuplexSheets|FAXUsageCounter.PrintReverseSheets0|FAXUsageCounter.PrintReverseShe
    ets1|FAXUsageCounter.PrintReverseSheets2|FAXUsageCounter.PrintReverseSheets3|FAX
    UsageCounter.PrintReverseSheets4|FAXUsageCounter.PrintReverseSheets5|FAXUsageCou
    nter.StoreForPollingPrintReverseSheets|FAXUsageCounter.PrintLargeSheets0|FAXUsag
    eCounter.PrintLargeSheets1|FAXUsageCounter.PrintLargeSheets2|FAXUsageCounter.Pri
    ntLargeSheets3|FAXUsageCounter.PrintLargeSheets4|FAXUsageCounter.PrintLargeSheet
    s5|IFAXUsageCounter.SendCount|IFAXUsageCounter.SendImpressions|IFAXUsageCounter.
    ReceivedCount|IFAXUsageCounter.ReceivedImpressions|IFAXUsageCounter.PrintImpress
    ions|IFAXUsageCounter.PrintSheets|IFAXUsageCounter.PrintDuplexSheets|IFAXUsageCo
    unter.PrintReverseSheets|IFAXUsageCounter.PrintLargeSheets|DirectFAXUsageCounter
    .SendCount|DirectFAXUsageCounter.SendImpressions|ServerFAXUsageCounter.SendCount
    |ServerFAXUsageCounter.SendImpressions|ScanUsageCounter.BWImpressions|ScanUsageC
    ounter.ColorImpressions|ScanUsageCounter.MailboxBWImpressions|ScanUsageCounter.M
    ailboxColorImpressions|ScanUsageCounter.FileBWImpressions|ScanUsageCounter.FileC
    olorImpressions|ScanUsageCounter.EMailBWImpressions|ScanUsageCounter.EMailColorI
    mpressions|ScanUsageCounter.MediaBWImpressions|ScanUsageCounter.MediaColorImpres
    sions|PrintUsageCounter.BWImpressions|PrintUsageCounter.ColorImpressions|PrintUs
    ageCounter.BW2upImpressions|PrintUsageCounter.Color2upImpressions|PrintUsageCoun
    ter.BWNupImpressions|PrintUsageCounter.ColorNupImpressions|PrintUsageCounter.BWS
    heets|PrintUsageCounter.ColorSheets|PrintUsageCounter.BWDuplexSheets|PrintUsageC
    ounter.ColorDuplexSheets|PrintUsageCounter.BWReverseSheets|PrintUsageCounter.Col
    orReverseSheets|PrintUsageCounter.BWLargeSheets|PrintUsageCounter.ColorLargeShee
    ts|DiagPrintUsageCounter.BWImpressions|DiagPrintUsageCounter.ColorImpressions|Di
    agPrintUsageCounter.BWSheets|DiagPrintUsageCounter.ColorSheets|DiagPrintUsageCou
    nter.BWLargeSheets|DiagPrintUsageCounter.ColorLargeSheets|CopyUsageCounter.BWImp
    ressions|CopyUsageCounter.ColorImpressions|CopyUsageCounter.BW2upImpressions|Cop
    yUsageCounter.Color2upImpressions|CopyUsageCounter.BWNupImpressions|CopyUsageCou
    nter.ColorNupImpressions|CopyUsageCounter.BWSheets|CopyUsageCounter.ColorSheets|
    CopyUsageCounter.BWDuplexSheets|CopyUsageCounter.ColorDuplexSheets|CopyUsageCoun
    ter.BWReverseSheets|CopyUsageCounter.ColorReverseSheets|CopyUsageCounter.BWLarge
    Sheets|CopyUsageCounter.ColorLargeSheets|ReportUsageCounter.BWImpressions|Report
    UsageCounter.ColorImpressions|ReportUsageCounter.BWSheets|ReportUsageCounter.Col
    orSheets|ReportUsageCounter.BWDuplexSheets|ReportUsageCounter.ColorDuplexSheets|
    ReportUsageCounter.BWReverseSheets|ReportUsageCounter.ColorReverseSheets|ReportU
    sageCounter.BWLargeSheets|ReportUsageCounter.ColorLargeSheets|LargeSizeUsageCoun
    ter.BWImpressions|LargeSizeUsageCounter.ColorImpressions|PaperSizeUsageCounter.A
    4|PaperSizeUsageCounter.UNSPECIFIED|FAXUsageCounter.SendCount0|FAXUsageCounter.S
    endCount1|FAXUsageCounter.SendCount2|FAXUsageCounter.SendCount3|FAXUsageCounter.
    SendCount4|FAXUsageCounter.SendCount5|FAXUsageCounter.SendImpressions0|FAXUsageC
    ounter.SendImpressions1|FAXUsageCounter.SendImpressions2|FAXUsageCounter.SendImp
    ressions3|FAXUsageCounter.SendImpressions4|FAXUsageCounter.SendImpressions5|FAXU
    sageCounter.PrintBW2upImpressions|FAXUsageCounter.BW1ImpressionJob|FAXUsageCount
    er.BW2ImpressionsJob|FAXUsageCounter.BW3ImpressionsJob|FAXUsageCounter.BW4Impres
    sionsJob|FAXUsageCounter.BW5ImpressionsJob|FAXUsageCounter.BW6ImpressionsJob|FAX
    UsageCounter.BW7ImpressionsJob|FAXUsageCounter.BW8ImpressionsJob|FAXUsageCounter
    .BW9ImpressionsJob|FAXUsageCounter.BW10To19ImpressionsJob|FAXUsageCounter.BW20To
    29ImpressionsJob|FAXUsageCounter.BW30To49ImpressionsJob|FAXUsageCounter.BW50To74
    ImpressionsJob|FAXUsageCounter.BW75To99ImpressionsJob|FAXUsageCounter.BW100To249
    ImpressionsJob|FAXUsageCounter.BWOver250ImpressionsJob|FAXUsageCounter.TotalTime
    Sent0|FAXUsageCounter.TotalTimeSent1|FAXUsageCounter.TotalTimeSent2|FAXUsageCoun
    ter.TotalTimeSent3|FAXUsageCounter.TotalTimeSent4|FAXUsageCounter.TotalTimeSent5
    |FAXUsageCounter.TotalTimeReceived0|FAXUsageCounter.TotalTimeReceived1|FAXUsageC
    ounter.TotalTimeReceived2|FAXUsageCounter.TotalTimeReceived3|FAXUsageCounter.Tot
    alTimeReceived4|FAXUsageCounter.TotalTimeReceived5|IFAXUsageCounter.Print2upImpr
    essions|IFAXUsageCounter.BW1ImpressionJob|IFAXUsageCounter.BW2ImpressionsJob|IFA
    XUsageCounter.BW3ImpressionsJob|IFAXUsageCounter.BW4ImpressionsJob|IFAXUsageCoun
    ter.BW5ImpressionsJob|IFAXUsageCounter.BW6ImpressionsJob|IFAXUsageCounter.BW7Imp
    ressionsJob|IFAXUsageCounter.BW8ImpressionsJob|IFAXUsageCounter.BW9ImpressionsJo
    b|IFAXUsageCounter.BW10To19ImpressionsJob|IFAXUsageCounter.BW20To29ImpressionsJo
    b|IFAXUsageCounter.BW30To49ImpressionsJob|IFAXUsageCounter.BW50To74ImpressionsJo
    b|IFAXUsageCounter.BW75To99ImpressionsJob|IFAXUsageCounter.BW100To249Impressions
    Job|IFAXUsageCounter.BWOver250ImpressionsJob|DirectFAXUsageCounter.SendCount0|Di
    rectFAXUsageCounter.SendCount1|DirectFAXUsageCounter.SendCount2|DirectFAXUsageCo
    unter.SendCount3|DirectFAXUsageCounter.SendCount4|DirectFAXUsageCounter.SendCoun
    t5|DirectFAXUsageCounter.SendImpressions0|DirectFAXUsageCounter.SendImpressions1
    |DirectFAXUsageCounter.SendImpressions2|DirectFAXUsageCounter.SendImpressions3|D
    irectFAXUsageCounter.SendImpressions4|DirectFAXUsageCounter.SendImpressions5|Pri
    ntUsageCounter.BW2upSimplexImpressions|PrintUsageCounter.Color2upSimplexImpressi
    ons|PrintUsageCounter.BW2upDuplexImpressions|PrintUsageCounter.Color2upDuplexImp
    ressions|PrintUsageCounter.BW4upSimplexImpressions|PrintUsageCounter.Color4upSim
    plexImpressions|PrintUsageCounter.BW4upDuplexImpressions|PrintUsageCounter.Color
    4upDuplexImpressions|PrintUsageCounter.BWNupSimplexImpressions|PrintUsageCounter
    .ColorNupSimplexImpressions|PrintUsageCounter.BWNupDuplexImpressions|PrintUsageC
    ounter.ColorNupDuplexImpressions|PrintUsageCounter.BW1ImpressionJob|PrintUsageCo
    unter.BW2ImpressionsJob|PrintUsageCounter.BW3ImpressionsJob|PrintUsageCounter.BW
    4ImpressionsJob|PrintUsageCounter.BW5ImpressionsJob|PrintUsageCounter.BW6Impress
    ionsJob|PrintUsageCounter.BW7ImpressionsJob|PrintUsageCounter.BW8ImpressionsJob|
    PrintUsageCounter.BW9ImpressionsJob|PrintUsageCounter.BW10To19ImpressionsJob|Pri
    ntUsageCounter.BW20To29ImpressionsJob|PrintUsageCounter.BW30To49ImpressionsJob|P
    rintUsageCounter.BW50To74ImpressionsJob|PrintUsageCounter.BW75To99ImpressionsJob
    |PrintUsageCounter.BW100To249ImpressionsJob|PrintUsageCounter.BWOver250Impressio
    nsJob|PrintUsageCounter.Color1ImpressionJob|PrintUsageCounter.Color2ImpressionsJ
    ob|PrintUsageCounter.Color3ImpressionsJob|PrintUsageCounter.Color4ImpressionsJob
    |PrintUsageCounter.Color5ImpressionsJob|PrintUsageCounter.Color6ImpressionsJob|P
    rintUsageCounter.Color7ImpressionsJob|PrintUsageCounter.Color8ImpressionsJob|Pri
    ntUsageCounter.Color9ImpressionsJob|PrintUsageCounter.Color10To19ImpressionsJob|
    PrintUsageCounter.Color20To29ImpressionsJob|PrintUsageCounter.Color30To49Impress
    ionsJob|PrintUsageCounter.Color50To74ImpressionsJob|PrintUsageCounter.Color75To9
    9ImpressionsJob|PrintUsageCounter.Color100To249ImpressionsJob|PrintUsageCounter.
    ColorOver250ImpressionsJob|CopyUsageCounter.BW2upSimplexImpressions|CopyUsageCou
    nter.Color2upSimplexImpressions|CopyUsageCounter.BW2upDuplexImpressions|CopyUsag
    eCounter.Color2upDuplexImpressions|CopyUsageCounter.BW4upSimplexImpressions|Copy
    UsageCounter.Color4upSimplexImpressions|CopyUsageCounter.BW4upDuplexImpressions|
    CopyUsageCounter.Color4upDuplexImpressions|CopyUsageCounter.BWNupSimplexImpressi
    ons|CopyUsageCounter.ColorNupSimplexImpressions|CopyUsageCounter.BWNupDuplexImpr
    essions|CopyUsageCounter.ColorNupDuplexImpressions|CopyUsageCounter.BWSimplexToD
    uplexSheets|CopyUsageCounter.ColorSimplexToDuplexSheets|CopyUsageCounter.BWDuple
    xToDuplexSheets|CopyUsageCounter.ColorDuplexToDuplexSheets|CopyUsageCounter.BWSi
    mplexToSimplexSheets|CopyUsageCounter.ColorSimplexToSimplexSheets|CopyUsageCount
    er.BWDuplexToSimplexSheets|CopyUsageCounter.ColorDuplexToSimplexSheets|CopyUsage
    Counter.BW1ImpressionJob|CopyUsageCounter.BW2ImpressionsJob|CopyUsageCounter.BW3
    ImpressionsJob|CopyUsageCounter.BW4ImpressionsJob|CopyUsageCounter.BW5Impression
    sJob|CopyUsageCounter.BW6ImpressionsJob|CopyUsageCounter.BW7ImpressionsJob|CopyU
    sageCounter.BW8ImpressionsJob|CopyUsageCounter.BW9ImpressionsJob|CopyUsageCounte
    r.BW10To19ImpressionsJob|CopyUsageCounter.BW20To29ImpressionsJob|CopyUsageCounte
    r.BW30To49ImpressionsJob|CopyUsageCounter.BW50To74ImpressionsJob|CopyUsageCounte
    r.BW75To99ImpressionsJob|CopyUsageCounter.BW100To249ImpressionsJob|CopyUsageCoun
    ter.BWOver250ImpressionsJob|CopyUsageCounter.Color1ImpressionJob|CopyUsageCounte
    r.Color2ImpressionsJob|CopyUsageCounter.Color3ImpressionsJob|CopyUsageCounter.Co
    lor4ImpressionsJob|CopyUsageCounter.Color5ImpressionsJob|CopyUsageCounter.Color6
    ImpressionsJob|CopyUsageCounter.Color7ImpressionsJob|CopyUsageCounter.Color8Impr
    essionsJob|CopyUsageCounter.Color9ImpressionsJob|CopyUsageCounter.Color10To19Imp
    ressionsJob|CopyUsageCounter.Color20To29ImpressionsJob|CopyUsageCounter.Color30T
    o49ImpressionsJob|CopyUsageCounter.Color50To74ImpressionsJob|CopyUsageCounter.Co
    lor75To99ImpressionsJob|CopyUsageCounter.Color100To249ImpressionsJob|CopyUsageCo
    unter.ColorOver250ImpressionsJob|CopyUsageCounter.BW1OriginalJob|CopyUsageCounte
    r.BW2OriginalsJob|CopyUsageCounter.BW3OriginalsJob|CopyUsageCounter.BW4Originals
    Job|CopyUsageCounter.BW5OriginalsJob|CopyUsageCounter.BW6OriginalsJob|CopyUsageC
    ounter.BW7OriginalsJob|CopyUsageCounter.BW8OriginalsJob|CopyUsageCounter.BW9Orig
    inalsJob|CopyUsageCounter.BW10To19OriginalsJob|CopyUsageCounter.BW20To29Original
    sJob|CopyUsageCounter.BW30To49OriginalsJob|CopyUsageCounter.BW50To74OriginalsJob
    |CopyUsageCounter.BW75To99OriginalsJob|CopyUsageCounter.BW100To249OriginalsJob|C
    opyUsageCounter.BWOver250OriginalsJob|CopyUsageCounter.Color1OriginalJob|CopyUsa
    geCounter.Color2OriginalsJob|CopyUsageCounter.Color3OriginalsJob|CopyUsageCounte
    r.Color4OriginalsJob|CopyUsageCounter.Color5OriginalsJob|CopyUsageCounter.Color6
    OriginalsJob|CopyUsageCounter.Color7OriginalsJob|CopyUsageCounter.Color8Original
    sJob|CopyUsageCounter.Color9OriginalsJob|CopyUsageCounter.Color10To19OriginalsJo
    b|CopyUsageCounter.Color20To29OriginalsJob|CopyUsageCounter.Color30To49Originals
    Job|CopyUsageCounter.Color50To74OriginalsJob|CopyUsageCounter.Color75To99Origina
    lsJob|CopyUsageCounter.Color100To249OriginalsJob|CopyUsageCounter.ColorOver250Or
    iginalsJob|PaperSizeUsageCounter.A3|PaperTrayUsageCounter.Tray1PrintedSheets|Pap
    erTrayUsageCounter.Tray2PrintedSheets|PaperTrayUsageCounter.Tray3PrintedSheets|P
    aperTrayUsageCounter.Tray4PrintedSheets|PaperTrayUsageCounter.Tray5PrintedSheets
    |PaperTrayUsageCounter.Tray6PrintedSheets|PaperTrayUsageCounter.Tray7PrintedShee
    ts|PaperTrayUsageCounter.Tray8PrintedSheets|PaperTrayUsageCounter.Tray1PrintedIm
    pressions|PaperTrayUsageCounter.Tray2PrintedImpressions|PaperTrayUsageCounter.Tr
    ay3PrintedImpressions|PaperTrayUsageCounter.Tray4PrintedImpressions|PaperTrayUsa
    geCounter.Tray5PrintedImpressions|PaperTrayUsageCounter.Tray6PrintedImpressions|
    PaperTrayUsageCounter.Tray7PrintedImpressions|PaperTrayUsageCounter.Tray8Printed
    Impressions|StoredDocumentUsageCounter.UnprintedDeletedImpressions|UptimeUsageCo
    unter.WarmUpTime|UptimeUsageCounter.IOTRunTime|UptimeUsageCounter.IITRunTime|Upt
    imeUsageCounter.LowPowerTime|UptimeUsageCounter.SleepTime|UptimeUsageCounter.Sta
    ndbyTime|UptimeUsageCounter.PowerOffTime
    ============= Line 3 =================
    3|ABCDEF|110139|ABC|2010-09-24T12:32:00+09:00|2010-09-24T12:32:28+09:00|||||||||
    ||||||||||||||||||||||||||||||||||||||||||||||||||||||0|0|0|0|0|0|0|0|0|0|0|0|0|
    309|159|158|16|0|0|151|129|0|0|4709|2105|1971|704|2|0|2760|1407|1877|769|0|0|47|
    86|0|0|0|0|0|0|305|21|1|0|0|0|204|18|101|3|0|0|1|1|60|0|51|0|9|0|0|0|0|0|77|92|4
    309|0|0|5|0|0|0|0|0|19|0|0|0|0|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|355|0|0|0|0|0
    |319|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|21|10|195
    0|694|0|0|2|0|0|0|2|0|422|292|60|38|24|18|18|26|8|60|34|20|3|0|0|0|233|138|36|30
    |10|20|9|11|7|27|17|6|2|1|0|0|1|0|0|0|0|0|0|0|0|0|0|0|5|1|96|2|103|15|0|0|84|7|0
    |4|1|0|0|0|0|0|1|0|0|0|1|0|13|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|80|12|0|3|1|0|0|0|0|
    1|0|0|1|0|0|0|14|3|0|0|0|0|0|0|0|0|0|0|0|0|0|0|135|3631|658|11|135|9|0|0|0|5901|
    1114|11|169|9|0|0|0|0|66|513|29|5715|102714|11941|28
    ============= Line 4 =================
    3|ABCDEF|110139|ABC|2010-09-24T13:34:00+09:00|2010-09-24T13:34:16+09:00|0|0|0|0|
    0|0|0|0|0|0|0|0|0|0|5|19|0|6|0|0|0|0|0|4|0|0|0|0|0|4|0|0|0|0|0|0|4|0|0|0|0|0|0|0
    |0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|309|159|158|16|0|
    0|151|129|0|0|4709|2105|1971|704|2|0|2760|1407|1877|769|0|0|47|86|0|0|0|0|0|0|30
    5|21|1|0|0|0|204|18|101|3|0|0|1|1|60|0|51|0|9|0|0|0|0|0|77|92|4309|0|0|5|0|0|0|0
    |0|19|0|0|0|0|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|355|0|0|0|0|0|319|0|0|0|0|0|0|
    0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|21|10|1950|694|0|0|2|0|0|0
    |2|0|422|292|60|38|24|18|18|26|8|60|34|20|3|0|0|0|233|138|36|30|10|20|9|11|7|27|
    17|6|2|1|0|0|1|0|0|0|0|0|0|0|0|0|0|0|5|1|96|2|103|15|0|0|84|7|0|4|1|0|0|0|0|0|1|
    0|0|0|1|0|13|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|80|12|0|3|1|0|0|0|0|1|0|0|1|0|0|0|14|
    3|0|0|0|0|0|0|0|0|0|0|0|0|0|0|135|3631|658|11|135|9|0|0|0|5901|1114|11|169|9|0|0
    |0|0|66|513|29|5730|102741|11960|28
    ============= Line 5 =================
    4|2010-09-25T02:00:24+09:00|2
    PL/SQL procedure successfully completed.
    SQL> Error you are getting is not file related. It simply tells line you read from file is too big to be displayed by DBMS_OUTPUT.PUT_LINE, which tells me you are on some older Oracle version. My test was conducted on 10.2.0.4.0. Try issuing SET SERVEROUTPUT ON SIZE 1000000 befor running your code.
    SY.

  • Client_text_io.get_line  causing a ora-06502

    I am reading a .csv file. Is there a limit to the amount of data that a client_text_io.get_line can read?

    If you are using 9i database or later then you may benefit from using an external table instead of reading the file line by line. If you have defined the table then all you need to do to access new data is move the csv file to the database server with webutil and read the data with sql commands. Changes to the csv format can be handled by changing the table definition, so the code stays the same. Also, it automatically handles number/date fields and reports any lines which contain invalid data, such as a varchar in a number field or null values.
    I don't know if there is a limit to the length of a line when using external tables but I did recently have a problem where one of the values was more than 256 characters. This could have been something I did rather than a limitation of ex.t. of course!

  • Plsql text_io.get_line EOF [SOLVED]

    Hi,
    Does anyone know how i can test for when the end of file has been reached through my plsql code?
    ta v much
    Message was edited by:
    TAhmed

    When the EOF is reached, a NO_DATA_FOUND exception is raised, even if you don't want to accept it !
    Begin
      Loop
         text_io.fget(...);
      End loop;
    Exception
      When no_data_found Then
        text_io.fclose(...);
    End;
    ...Francois

  • How to handle exception CX_SY_REF_IS_INITIAL

    hi experts,
    im working on a test scenario for abap mapping in SAP XI im getting this error
    An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference
    i understand that i need to catch this exception in the abap coding but i'm not familiar with oops concepts
    can any one please suggest me how to handle this exception for the following code...
    method IF_MAPPING~EXECUTE.
      break x1149.
    * initialize iXML
      TYPE-POOLS: ixml.
      class cl_ixml definition load.
    ** Instances & Variable declaration =======================
    * instance main factory
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml TYPE REF TO if_ixml,
    * instance input stream factory
       l_streamfactory TYPE REF TO if_ixml_stream_factory,
    * instance input stream
      l_istream  TYPE REF TO if_ixml_istream,
    * instance input document
      l_document TYPE REF TO if_ixml_document,
    * instance parse input document
      l_parser TYPE REF TO if_ixml_parser,
    * instance for elements within the nodes
      node      TYPE REF TO if_ixml_node,
    *instance of nodemap
      nodemap   TYPE REF TO if_ixml_named_node_map,
    * instance for iterator
      iterator  TYPE REF TO if_ixml_node_iterator,
      name      TYPE string,
      value     TYPE string,
    * instance main factory
       o_ixml   TYPE REF TO if_ixml,
    * instance output document
       o_document TYPE REF TO if_ixml_document,
    * instance output stream
      o_istream  TYPE REF TO if_ixml_ostream,
    * instance parse output document
      o_parser  TYPE REF TO if_ixml_parser,
    * instance fot renderer
      renderer type ref to if_ixml_renderer,
      irc type i,
      l_xml_size   TYPE i,
    *ROOT ELEMENT
    l_element_MT_DEMANDTEC_COST TYPE REF TO if_ixml_element,
    *NEXT CHILD ELEMENT FROM THE ABOVE PARENT
    l_element_DT_DEMANDTEC TYPE REF TO if_ixml_element,
    *CHILDREN1 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_WHSE  TYPE REF TO if_ixml_element,
    *CHILDREN2 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_DC    TYPE REF TO if_ixml_element,
    *CHILDREN3 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_PLANT    TYPE REF TO if_ixml_element,
    *CHILDREN4 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_QTY    TYPE REF TO if_ixml_element.
    *saving the xml document
      DATA: l_xml_table       TYPE TABLE OF t_xml_line.
      types: begin of t_source,
              whse(5),
              dc(4) ,
              plant(4),
              qty    type i,
             end of t_source.
      types: tt_source TYPE STANDARD TABLE OF t_source.
      data:  wa_source type t_source.
      data: it_source TYPE  tt_source,
            ivalue type string.
    * Procedures and business logic =======================================
    *   Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
    * create input stream
      l_istream = l_streamfactory->create_istream_xstring( source ).
    *  initialize input document
      l_document = l_ixml->create_document( ).
    *  Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    * parse input document
      l_parser->parse( ).
    *   Validate a document
      l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    *   Parse the stream
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
            parseerror = l_parser->get_error( index = index ).
            i = parseerror->get_line( ).
            WRITE: 'line: ', i.
            i = parseerror->get_column( ).
            WRITE: 'column: ', i.
            str = parseerror->get_reason( ).
            WRITE: str.
            index = index + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF l_parser->is_dom_generating( ) EQ 'X'.
        refresh : it_source.
        node ?= l_document.
        CHECK NOT node IS INITIAL.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
            WHEN if_ixml_node=>co_node_text.
    *         text node
              value  = node->get_value( ).
              if name eq 'DT_WHSE'.
                wa_source-whse = value.
              ELSEIF name eq 'DT_DC'.
                wa_source-DC = value.
              ELSEIF name eq 'DT_PLANT'.
                wa_source-PLANT = value.
              ELSEIF name eq 'DT_QTY'.
                wa_source-QTY = value.
                COLLECT wa_source INto it_source.
                CLEAR   wa_source.
              ENDIF.
          endcase.
          node = iterator->get_next( ).
        endwhile.
      ENDIF.
      loop at it_source into wa_source .
        at first.
    *       Creating a ixml factory
          o_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
          o_document = l_ixml->create_document( ).
        endat.
    *       Build and Fill  root node MT_DEMANDTEC_COST
        AT FIRST.
          l_element_MT_DEMANDTEC_COST    =
    O_document->create_simple_element(
                                  name   = 'MT_DEMANDTEC_COST'
                                  parent = o_document ).
        ENDAT.
    *      Build and Fill  Child node DT_DEMANDTEC for parent
    *                                                  MT_DEMANDTEC_COST
        l_element_DT_DEMANDTEC    = O_document->create_simple_element(
                                     name   = 'DT_DEMANDTEC'
                                     parent = l_element_MT_DEMANDTEC_COST ).
    *      Build and Fill  Child node1 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-WHSE.
        l_element_DT_WHSE    = O_document->create_simple_element(
                                         name   = 'DT_WHSE'
                                         VALUE  = ivalue
                                         parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node2 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-DC.
        l_element_DT_DC   = O_document->create_simple_element(
                                             name   = 'DT_DC'
                                              VALUE  = ivalue
                                    parent = l_element_DT_DEMANDTEC ).
    *      Build and Fill  Child node3 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-PLANT.
        l_element_DT_PLANT   = O_document->create_simple_element(
                                                 name   = 'DT_PLANT'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node4 DT_QTY for parent DT_DEMANDTEC
        ivalue              = wa_source-QTY.
        l_element_DT_QTY     = O_document->create_simple_element(
                                                 name   = 'DT_QTY'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
      endloop.
    * render document ======================================================
    * create output stream
      o_istream  = l_streamfactory->create_ostream_xstring( result ).
    *   Connect internal XML table to stream factory
      o_istream  = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      renderer = o_ixml->create_renderer( ostream = o_istream
                                              document = o_document ).
      irc = renderer->render( ).
    * how do i catch the exception for type CX_SY_REF_IS_INITIAL ...?
    endmethod.
    full reward points for answers.
    Thanks & Regards,
    Uday Kumar.
    Edited by: UDAY on May 6, 2008 9:32 PM

    Hi Uday,
    Its occurs because you're trying to access a objects with null reference. Or you forgot to create an instance or an error occurs during the instance creation. So You should put all your "Procedures and business logic" inside a Try/catch block. as follow.
    " Define a class exception object to get error message......
    DATA o_exception TYPE REF TO cx_sy_ref_is_initial.
    "// Use the statment Try block to catch the error.
    TRY.
    *   Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
    * create input stream
      l_istream = l_streamfactory->create_istream_xstring( source ).
    *  initialize input document
      l_document = l_ixml->create_document( ).
    *  Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    * parse input document
      l_parser->parse( ).
    *   Validate a document
      l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    *   Parse the stream
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
            parseerror = l_parser->get_error( index = index ).
            i = parseerror->get_line( ).
            WRITE: 'line: ', i.
            i = parseerror->get_column( ).
            WRITE: 'column: ', i.
            str = parseerror->get_reason( ).
            WRITE: str.
            index = index + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF l_parser->is_dom_generating( ) EQ 'X'.
        refresh : it_source.
        node ?= l_document.
        CHECK NOT node IS INITIAL.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
            WHEN if_ixml_node=>co_node_text.
    *         text node
              value  = node->get_value( ).
              if name eq 'DT_WHSE'.
                wa_source-whse = value.
              ELSEIF name eq 'DT_DC'.
                wa_source-DC = value.
              ELSEIF name eq 'DT_PLANT'.
                wa_source-PLANT = value.
              ELSEIF name eq 'DT_QTY'.
                wa_source-QTY = value.
                COLLECT wa_source INto it_source.
                CLEAR   wa_source.
              ENDIF.
          endcase.
          node = iterator->get_next( ).
        endwhile.
      ENDIF.
      loop at it_source into wa_source .
        at first.
    *       Creating a ixml factory
          o_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
          o_document = l_ixml->create_document( ).
        endat.
    *       Build and Fill  root node MT_DEMANDTEC_COST
        AT FIRST.
          l_element_MT_DEMANDTEC_COST    =
    O_document->create_simple_element(
                                  name   = 'MT_DEMANDTEC_COST'
                                  parent = o_document ).
        ENDAT.
    *      Build and Fill  Child node DT_DEMANDTEC for parent
    *                                                  MT_DEMANDTEC_COST
        l_element_DT_DEMANDTEC    = O_document->create_simple_element(
                                     name   = 'DT_DEMANDTEC'
                                     parent = l_element_MT_DEMANDTEC_COST ).
    *      Build and Fill  Child node1 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-WHSE.
        l_element_DT_WHSE    = O_document->create_simple_element(
                                         name   = 'DT_WHSE'
                                         VALUE  = ivalue
                                         parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node2 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-DC.
        l_element_DT_DC   = O_document->create_simple_element(
                                             name   = 'DT_DC'
                                              VALUE  = ivalue
                                    parent = l_element_DT_DEMANDTEC ).
    *      Build and Fill  Child node3 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-PLANT.
        l_element_DT_PLANT   = O_document->create_simple_element(
                                                 name   = 'DT_PLANT'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node4 DT_QTY for parent DT_DEMANDTEC
        ivalue              = wa_source-QTY.
        l_element_DT_QTY     = O_document->create_simple_element(
                                                 name   = 'DT_QTY'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
      endloop.
    * render document ======================================================
    * create output stream
      o_istream  = l_streamfactory->create_ostream_xstring( result ).
    *   Connect internal XML table to stream factory
      o_istream  = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      renderer = o_ixml->create_renderer( ostream = o_istream
                                              document = o_document ).
      irc = renderer->render( ).
    "   The Statement CATCH define a block that catches the exceptions of the
    "   exception class cx_sy_ref_is_initial
        CATCH cx_sy_ref_is_initial INTO o_exception.
    " If you need to get the error message text do as follow
    DATA errorMsg type string.
    " Get the message text
      errorMsg = o_exception->GET_TEXT( ).
    " Display the error information
      MESSAGE errorMsg TYPE 'I'.
      ENDTRY.
    The TRY block defines a guarded area whose class-based exceptions can be caught in the subsequent CATCH blocks. If no exception occurs in the TRY block and it reaches its end, the system continues the processing after ENDTRY. If a class-based exception occurs in the TRY block, the system searches for an exception handler in the same or an external TRY control structure.
    Font: SAP Help
    You can see a how to create and use an exception in this example [ ABAP Objects - Defining a Class-based exceptions|https://wiki.sdn.sap.com/wiki/x/19w] .
    Best Regards.
    Marcelo Ramos

  • How to get the data from a file and insert into a table

    Good morning,
    NEED TO READ THIS FILE sui_facturacion_alcantarillado_15085_2011_01_76845_00A.csv containing the following information
    NUID,NUMERO_DE_CUENTA_CONTRATO,CÓDIGO_DANE_DEPARTAMENTO,CÓDIGO_DANE_MUNICIPIO,ZONA_IGAC,SECTOR_IGAC,MANZANA_O_VEREDA_IGAC,NÚMERO_DEL_PREDIO_IGAC,CONDICION_DE_PROPIEDAD_DEL_PREDIO_IGAC,DIRECCIÓN_DEL_PREDIO,NÚMERO_DE_FACTURA,FECHA_DE_EXPEDICIÓN_DE_LA_FACTURA,FECHA_DE_INICIO_DEL_PERÍODO_DE_FACTURACIÓN,DIAS_FACTURADOS,CÓDIGO_CLASE_DE_USO,UNIDADES_MULTIUSUARIO_RESIDENCIAL,UNIDADES_MULTIUSUARIO_NO_RESIDENCIAL,HOGAR_COMUNITARIO_O_SUSTITUTO,USUARIO_FACTURADO_CON_AFORO,USUARIO_CUENTA_CON_CARACTERIZACIÓN,CARGO_FIJO,CARGO_POR_VERTIMIENTO_BASICO,CARGO_POR_VERTIMIENTO_COMPLEMENTARIO,CARGO_POR_VERTIMIENTOSUNTUARIO,CMT,VERTIMIENTO_DEL_PERIOD_EN_METROS_CUBICOS,VALOR_FACTURADO_POR_VERTIDO,VALOR_DEL_SUBSIDIO,VALOR_DE_LA_CONTRIBUCIÓN,FACTOR_DE_SUBSIDIO_O_CONTRIBUCIÓN_CARGO_FIJO,FACTOR_DE_SUBSIDIO_O_CONTRIBUCIÓN_VERTIMIENTO,CARGOS_POR_CONEXIÓN,PAGO_ANTICIPADO_DEL_SERVICIO,DÍAS_DE_MORA,VALOR_DE_MORA,INTERESES_POR_MORA,OTROS_COBROS,CAUSAL_DE_REFACTURACIÓN,NUMERO_DE_LA_FACTURA_OBJETO_DE_REFACTURACIÓN,VALOR_TOTAL_FACTURADO,PAGOS_DEL_CLIENTE_DURANTE_EL_PERÍODO_FACTURADO
    242602,242602,76,845,99,99,9999,9999,999,CLL 5 CRA 7 PEATONAL,24911920,12-01-2011,01-12-2010,30,01,,,0,0,0,1,0000000000.00,0000000000.00,0000000000.00,0000000000.00,0000000005,0000002200.00,0000000000,0000000000,0.000,0.000,0000000000.00,0000000000.00,0,0000000000.00,0000000000.00,0000000000.00,0,0,0000002201.00,0000000000.00
    242604,242604,76,845,99,99,9999,9999,999,CRA 4 # 6 - 13,24911846,12-01-2011,01-12-2010,30,01,,,0,0,0,1,0000000000.00,0000000000.00,0000000000.00,0000000000.00,0000000013,0000002200.00,0000000000,0000000000,0.000,0.000,0000000000.00,0000000000.00,0,0000000000.00,0000000000.00,0000000000.00,0,0,0000002201.00,0000004411.00
    242605,242605,76,845,99,99,9999,9999,999,CRA 2 CLLES 3 Y 4,24911509,12-01-2011,01-12-2010,30,01,,,0,0,0,1,0000000000.00,0000000000.00,0000000000.00,0000000000.00,0000000004,0000002200.00,0000000000,0000000000,0.000,0.000,0000000000.00,0000000000.00,0,0000000000.00,0000000000.00,0000000000.00,0,0,0000002201.00,0000002200.00
    this is the function that I have
    <<function_test>>
    DECLARE
    TOTAL_CAR NUMBER;
    POS_1 NUMBER:= 0;
    POS_2 NUMBER:= 0;
    REST NUMBER:= 0;
    ACUM NUMBER:= 0;
    CADEN VARCHAR2(200);
    nom_archivo varchar2(80);
    v1 utl_file.file_type;
    v2 varchar2(2048);
    BEGIN
         nom_archivo := 'sui_facturacion_alcantarillado_15085_2011_01_76845_00A.csv';
         v1:= utl_file.fopen('PUBLIC_ACCESS',nom_archivo,'R',32767);
         utl_file.get_line(v1,v2);
         SELECT LENGTH(v2) INTO TOTAL_CAR FROM DUAL;
         ACUM:=1;
         POS_1:=0;
         WHILE ACUM <= 60
         LOOP
              select instr(v2, ',', 1, ACUM) PRUEBA
              INTO      POS_2
              FROM      DUAL;
              dbms_output.put_line(' TOTAL POSICION 1--> '|| POS_1);
              dbms_output.put_line(' TOTAL POSICION 2--> '|| POS_2);
              dbms_output.put_line(' TOTAL ACUMULADO --> '|| ACUM);
              REST := (POS_2-POS_1)-1;
              SELECT SUBSTR(v2,(POS_1+1),REST) PRUEBA2
                   INTO CADEN
              FROM      DUAL;     
              dbms_output.put_line(' CADENA SELECCIONADA --> '|| CADEN);
              ACUM := ACUM + 1;
              POS_1:= POS_2;
         END LOOP;
         utl_file.fclose(v1);
         dbms_output.put_line(' -->');
         dbms_output.put_line(' TOTAL POSICION 1-->'|| POS_1);
         dbms_output.put_line(' TOTAL POSICION 2-->'|| POS_2);
         dbms_output.put_line(' TOTAL ACUMULADO -->'|| ACUM);
         dbms_output.put_line(' TOTAL DE CARACTERES -->'|| TOTAL_CAR);
         dbms_output.put_line(' ');     
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   dbms_output.put_line('NO SE ENCONTRARON MAS CARACTERES');
              WHEN OTHERS THEN
                   dbms_output.put_line('OTRO TIPO DE ERROR ');
                   dbms_output.put_line('CODIGO ERROR '|| SQLCODE ||' '||SQLERRM);
    END;
    Which must be separated by a comma and enter a table I have the following procedure in which only brings me the first line, which need not
    The current role I have just read and extract data from the row number 1, I do not need information.
    I need information for rows 2,3,4. In each row there are 41 fields, which I enter in a table called Dato_archivos.
    how to perform this function? ...
    I appreciate the cooperation and explanation ...
    GOOD DAY ...
    REYNEL SALAZAR MARTINEZ
    COLOMBIA ...

    When you get an error with external tables (or sql*loader) look in the same folder as the data file and you should get a .log file and maybe a .bad file too.
    The log file should indicate the nature of the error it has trying to load the data.
    I've just copied your sample data from your first post to a file on my server and tried it to find that you are not specifying the required format for your dates. The below shows it now working...
    CREATE TABLE tabla_prueba
      (NUID NUMBER,
       NUM_CUENTA_CONTRATO NUMBER,
       COD_DANE_DD NUMBER,
       COD_DANE_MM NUMBER,
       ZONA_IGAC NUMBER,
       SECTOR_IGAC NUMBER,
       MANZANA_VEREDA_IGAC NUMBER,
       NUM_PREDIO_IGAC NUMBER,
       CONDICION_PREDIO_IGAC NUMBER,
       DIRECCION_PREDIO_IGAC VARCHAR2(80),
       NUM_FACTURA NUMBER,
       FECHA_EXPED_FACTURA DATE,
       FECHA_INI_PERIODO_FACTURACION DATE,
       DIAS_FACTURADOS NUMBER,
       COD_CLASE_USO NUMBER,
       UNI_MULTIUSUARIO_RESIDENCIAL NUMBER,
       UNI_MULTIUSUARIO_NORESIDENCIAL NUMBER,
       HOGAR_COMUNITARIO NUMBER,
       USUARIO_FACTURADO_AFORO NUMBER,
       USUARIO_CON_CARACTERIZACION NUMBER,
       CARGO_FIJO NUMBER,
       CARGO_VERTIMENTO_BAS NUMBER,
       CARGO_VERTIMENTO_COMP NUMBER,
       CARGO_VERTIMENTO_SUNT NUMBER,
       CMT NUMBER,
       VLR_FACTURADO_VERTIDO NUMBER,
       VLR_SUBSIDIO NUMBER,
       VLR_CONTRIBUCCION NUMBER,
       FACTOR_SUBS_CONTR_CARGO_FIJO NUMBER,
       FACTOR_SUBS_CONTR_VERTIMENTO NUMBER,
       CARGO_CONEXION NUMBER,
       PAGO_ANTICIPADO_SERVICIO NUMBER,
       DIAS_MORA NUMBER,
       VLR_MORA NUMBER,
       INTERES_MORA NUMBER,
       OTROS_COBROS NUMBER,
       CAUSAL_REFACTURACION NUMBER,
       NUM_FACTURA_OBJ_REFACTURACION NUMBER,
       VLR_TOTAL_FACTURADO NUMBER,
       PAGOS_CLIENTE_DURANTE_PERIODO NUMBER
    ORGANIZATION EXTERNAL
      (TYPE ORACLE_LOADER
       DEFAULT DIRECTORY TEST_DIR
       ACCESS PARAMETERS
        (RECORDS DELIMITED BY NEWLINE
         SKIP 1
         FIELDS TERMINATED BY ","
         OPTIONALLY ENCLOSED BY '"'
          (NUID,
           NUM_CUENTA_CONTRATO,
           COD_DANE_DD,
           COD_DANE_MM,
           ZONA_IGAC,
           SECTOR_IGAC,
           MANZANA_VEREDA_IGAC,
           NUM_PREDIO_IGAC,
           CONDICION_PREDIO_IGAC,
           DIRECCION_PREDIO_IGAC,
           NUM_FACTURA,
           FECHA_EXPED_FACTURA CHAR DATE_FORMAT DATE MASK "DD-MM-YYYY",
           FECHA_INI_PERIODO_FACTURACION CHAR DATE_FORMAT DATE MASK "DD-MM-YYYY",
           DIAS_FACTURADOS,
           COD_CLASE_USO,
           UNI_MULTIUSUARIO_RESIDENCIAL ,
           UNI_MULTIUSUARIO_NORESIDENCIAL,
           HOGAR_COMUNITARIO ,
           USUARIO_FACTURADO_AFORO ,
           USUARIO_CON_CARACTERIZACION ,
           CARGO_FIJO ,
           CARGO_VERTIMENTO_BAS ,
           CARGO_VERTIMENTO_COMP,
           CARGO_VERTIMENTO_SUNT,
           CMT,
           VLR_FACTURADO_VERTIDO,
           VLR_SUBSIDIO ,
           VLR_CONTRIBUCCION ,
           FACTOR_SUBS_CONTR_CARGO_FIJO ,
           FACTOR_SUBS_CONTR_VERTIMENTO ,
           CARGO_CONEXION ,
           PAGO_ANTICIPADO_SERVICIO ,
           DIAS_MORA ,
           VLR_MORA ,
           INTERES_MORA ,
           OTROS_COBROS ,
           CAUSAL_REFACTURACION ,
           NUM_FACTURA_OBJ_REFACTURACION,
           VLR_TOTAL_FACTURADO,
           PAGOS_CLIENTE_DURANTE_PERIODO
        LOCATION ('test.csv')
    SQL> select * from tabla_prueba;
          NUID NUM_CUENTA_CONTRATO COD_DANE_DD COD_DANE_MM  ZONA_IGAC SECTOR_IGAC MANZANA_VEREDA_IGAC NUM_PREDIO_IGAC CONDICION_PREDIO_IGAC DIRECCION_PREDIO_IGAC                                                    NUM_FACTURA FECHA_EXPE FECHA_INI_
    DIAS_FACTURADOS COD_CLASE_USO UNI_MULTIUSUARIO_RESIDENCIAL UNI_MULTIUSUARIO_NORESIDENCIAL HOGAR_COMUNITARIO USUARIO_FACTURADO_AFORO USUARIO_CON_CARACTERIZACION CARGO_FIJO CARGO_VERTIMENTO_BAS CARGO_VERTIMENTO_COMP CARGO_VERTIMENTO_SUNT        CMT
    VLR_FACTURADO_VERTIDO VLR_SUBSIDIO VLR_CONTRIBUCCION FACTOR_SUBS_CONTR_CARGO_FIJO FACTOR_SUBS_CONTR_VERTIMENTO CARGO_CONEXION PAGO_ANTICIPADO_SERVICIO  DIAS_MORA   VLR_MORA INTERES_MORA OTROS_COBROS CAUSAL_REFACTURACION NUM_FACTURA_OBJ_REFACTURACION
    VLR_TOTAL_FACTURADO PAGOS_CLIENTE_DURANTE_PERIODO
        242602              242602          76         845         99          99                9999         9999              999 CLL 5 CRA 7 PEATONAL                                                         24911920 12-01-2011 01-12-2010
                 30             1                                                                             0               0                           0          1                    0                     0                     0          0
                        5         2200                 0                            0                            0              0                        0          0          0            0            0                    0                             0
                      0                          2201
        242604              242604          76         845         99          99                9999         9999              999 CRA 4 # 6 - 13                                                               24911846 12-01-2011 01-12-2010
                 30             1                                                                             0               0                           0          1                    0                     0                     0          0
                       13         2200                 0                            0                            0              0                        0          0          0            0            0                    0                             0
                      0                          2201
        242605              242605          76         845         99          99                9999         9999              999 CRA 2 CLLES 3 Y 4                                                            24911509 12-01-2011 01-12-2010
                 30             1                                                                             0               0                           0          1                    0                     0                     0          0
                        4         2200                 0                            0                            0              0                        0          0          0            0            0                    0                             0
                      0                          2201
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to use Linux Print queue in client_text_io.fopen to print from Windows

    We have a forms application deploed on LINUX (Oracle application server 10g).
    I have to print a file from local windows PC to a linux Print Queue from forms
    I have the following code
    PROCEDURE file_to_printer (i_filename_output IN VARCHAR2
    ,i_network_printer IN VARCHAR2) IS
    l_line VARCHAR2(2000);
    l_fileid_output client_text_io.file_type;
    l_fileid_print client_text_io.file_type;
    BEGIN
    l_fileid_output := client_text_io.fopen (i_filename_output,'R');
    l_fileid_print := client_text_io.fopen (i_network_printer,'W');
    WHILE 1 = 1 LOOP
    client_text_io.get_line (l_fileid_output, l_line);
    client_text_io.put_line (l_fileid_print, l_line);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    client_text_io.fclose (l_fileid_output);
    client_text_io.fclose (l_fileid_print);
    END file_to_printer;
    Everything works fine if I use a windows printer like \\machine\printer.
    I want to use a Linux printer and specified the print queue as
    \\machine\print_queue_name. It's not working
    and I get error ORA-302000 on the following line
    l_fileid_print := client_text_io.fopen (i_network_printer,'W');
    and if I give only the queue name no error but it's not printing.
    Could you please tell me how to use a Linux/Unix print queue in this situation

    the simplest way is to edit the interface file (look in /etc/lp/interfaces for existing printers). Each script is
    run per print job where stdin has your print data, and stdout is going to your print device. You can just
    send the output to a file instead (assuming you can create a file in the windows directory from the solaris
    box). If it's a network share, you could use smbclient.
    -r

Maybe you are looking for