UTL_FILE

I'm using oracle 11g Express edition

I get this message when I try to declare a file_type variable:

I'm using oracle 11g Express edition

I tried to grant permission to run the package to the user (System)

but I get 00942 table or view does not exist.

the utl_file package is available for this?

the utl_file package is available for this?

Yes.

I tried to grant permission to run the package to the user (System)

What exact command you run and from which the user?

Tags: Database

Similar Questions

  • UTL_FILE. PUT_LINE

    friends, I have the following problem, I use this command UTL_FILE. Put_line but who puts the data in a file and makes it perfect, everytime you complete a line jump down I can do to make the next line is Pan below?

    UTL_FILE. Put_line-online text written in a tracking file to an end of line marker

    UTL_FILE. PUT-online text written in a file

    You probably want the latter.

  • How to report on Oracle 11 g XE UTL_FILE.

    Hi, I have installed Oracle 11 g XE and the need to declare UTL_FILE.

    When you run a package you get the error: PLS-00201: identifier 'UTL_FILE' must be declared.

    In different forums to refer both to create a SYS user and I use the command:

    Grant execute on UTL_FILE sys;

    The problem is that there is no SYS user in Oracle 11 g XE. There is only the SYSTEM user.

    When I connect as a system and apply order GRANT... and I get the error:

    ORA-00942: table or view does not exist

    How I UTL_FILE grant and report to Oracle 11 g XE?

    I'm sorry, my English isn't the best.

    Hello

    Of course UTL_FILE exists in Oracle 11 g XE. To grant access, you will need to connect as user SYS.

    Try "sqlplus / as sysdba" to the console of the server to connect as sys. Make sure you are in a group ORA_DBA OS (Windows) or the Group dba (Linux)

    Best regards!

  • problem with utl_file

    Dear all,

    Oracle Version: 10.2.0.5.0

    I am trying to create a folder for the utl_fil utility to export the data with the following options

    create or replace directory utl_file_dir as ' / tmp'


    I do not have see the/tmp file is created, could you please suggest if I do something wrong.

    where the 'tmp' file, will be created is in the C drive?

    Abhishek

    Directory is Oracle as a pointer. It points to a directory of the operating system.

    If your statement

    create or replace directory utl_file_dir as ' / tmp'

    Creates a directory object that points to an OS/tmp directory. Oracle does not validate the existence of the OS directory when creating the directory object.

    So now you must issue a command to OS level to create a physical directory. For example, on Unix you can do this

    mkdir/tmp

    This will create a tmp directory in the OS.

  • dmp Impdp file error: ORA-29283: operation invalid file ORA-06512: at "SYS." UTL_FILE", line 536

    Hi all.

    Sorry to ask this error again, I read a lot of topic in this forum on this subject, but I can't fix it.

    So I create this topic.

    My computer is running oracle database 11 g 2 express edition on ubuntu LTS 14.04.

    I'm trying to import the database of dmp file. That's what I do:


    > sqplus

    opening session with sys as sysdba, then run:

    Hoangnv CREATE USER IDENTIFIED BY hoangnv;

    GRANT CONNECT TO hoangnv;

    GRANT RESOURCE, s/n hoangnv;

    CREATE OR REPLACE DIRECTORY dmpdir AS ' / home/hoangnv/downloads/db ";

    GRANT read, write the DIRECTORY ON dmpdir TO hoangnv;


    my_project.dmp file is stored on /home/hoangnv/Downloads/db folder.

    Finally, I ran the command below in terminal:

    impdp hoangnv/hoangnv@xe directory = dmpdir dumpfile = my_project.dmp logfile = my_project.log


    That's what see the Terminal:

    ORA-39002: invalid operation

    ORA-39070: unable to open the log file.

    ORA-29283: invalid file operation

    ORA-06512: at "SYS." UTL_FILE", line 536

    ORA-29283: invalid file operation

    Any ideas? I run these commands on window and import the database successfully.

    Hello

    Please try the suggestions below:

    1. make sure that the roles granted to the user are 'default' for him.

    SQL > change the user hoangnv the role by default all;

    then try to re-import.

    Note: the DBA role contains the IMP_FULL_DATABASE with it.

    2. try import with the use of the 'System' this time, which is the result then? don't forget to give the system read, write on directory dmpdir.

    3. is the permission to/home/hoangnv/Downloads/db fine OS?

  • UTL_FILE.get_line not able to read large files...

    Dear all,

    UTL_FILE.get_line is not able to read data from file. can you suggest me to fix this problem...

    Here is my code;

    declare

    l_file_handle UTL_FILE. Type_de_fichier;

    l_input_line varchar2 (6000);

    Start

    l_file_name: = 'abc.csv ';

    l_path: = ' / u02/R12UAT/apps/apps_st/appl/XXSES/12.0.0/bin';

    l_file_handle: = UTL_FILE. FOPEN (l_path, l_file_name, 'R', 32767);

    loop

    UTL_FILE. GET_LINE (l_input_file, l_input_line);

    fnd_file.put_line (fnd_file.log, l_input_line);

    end loop;

    UTL_FILE.fclose (l_file_handle);

    end;

    After reading a few lines I have a get the error;

    ORA-06502: PL/SQL: digital or value error: character string buffer too small

    I have to read data from file with UTL_FILE. Do not use SQLLDR

    Thank you.

    Kind regards

    Ravi.

    Your call to FOPEN() function specifies a size of 32K maximum line. When you call GET_LINE() without specifying the number of characters to get, Oracle will therefore assume you want to get 32K characters. However, your stamp, L_INPUT_LINE, is defined as VARCHAR2 (6000). That is, it is much too small.

    The solution is to call GET_LINE() with the third parameter set to 6000.

    BTW, you can also set a condition of release on the loop.

  • with utl_file - save the result in a txt file.

    PLS, help...

    I have a question that I used to use SQL PLUS, using the COIL and it worked very well.

    Now, I'm changing it to pl/sql, which I'll have to use UTL_FILE.

    The problem is that I need to create a file with a pre defined provision.

    Can help you me pls?

    Don't have much experience with UTL_FILE

    Prompt 'Periodo MON-YY:'
    Define periodo = '&periodo'
    SPOOL C:\Users\gtorrens\Documents\GLAudit_2014_2015\gl_audit-&&periodo..txt
    set termout off
    set echo off
    set verify off
    set feedback off
    set serveroutput off
    set head off
    set pagesize 0
    set linesize 608
    set timing off 
    SELECT /*+
             INDEX(GCC GL_CODE_COMBINATIONS_U1)
             INDEX(GJB GL_JE_BATCHES_U1)
             INDEX(FUS FND_USER_U1)
             INDEX(GJL GL_JE_LINES_U1)*/
              rpad(SUBSTR (gcc.segment1, 1, 2),2,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (emp.de_sgm, 1, 70), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),70,' ')
               || rpad(SUBSTR (gjs.user_je_source_name, 1, 20),20,' ')
               || lpad(DECODE (NVL (gjl.entered_dr, 0)
                        , 0, DECODE (NVL (gjl.accounted_dr, 0), 0, 'C', 'D')
                        , 'D'),1,' ')
               || lpad(TO_CHAR (gjh.default_effective_date, 'DD-MON-YY'),9,' ')
               || lpad(TO_CHAR (gjh.posted_date, 'DD-MON-YY'),9,' ')
               || lpad(SUBSTR (gcc.segment2, 1, 9),9,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (cta.de_sgm, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || rpad(SUBSTR (cta.tp_sgm, 1, 10),10,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_dr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_cr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(SUBSTR (gjh.currency_code, 1, 5),5,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (REPLACE (SUBSTR (gjl.description, 1, 150), '|', '@'), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),150,' ')
               || rpad(gjb.last_updated_by,15,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (gjb.name, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || lpad(SUBSTR (fus.user_name, 1, 30),30, ' ')
                 linha_utl
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041 -- p_nr_livro
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = upper('&&periodo') -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
        --  AND rownum<1001
           ;
        SELECT /*+
             INDEX(GCC GL_CODE_COMBINATIONS_U1)
             INDEX(GJB GL_JE_BATCHES_U1)
             INDEX(FUS FND_USER_U1)
             INDEX(GJL GL_JE_LINES_U1)*/
                    (lpad(TO_CHAR (NVL (SUM(gjl.accounted_dr), 0),'999G999G999G999G999G990D00'),268,' ')) /*VL_DEBITO*/
             ||' '||(lpad(TO_CHAR (NVL (SUM(gjl.accounted_cr), 0),'999G999G999G999G999G990D00'),37 ,' ')) /*VL_CREDITO*/
             ||' '|| TO_CHAR (COUNT (*)) soma /*qtd_reg*/
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = '&&periodo' -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
          -- and rownum<1001;
                  
    spool off;
    
    

    I did something like that, when I turned it in a procedure...

    create or replace PROCEDURE       XXTVGAUDIT (o_return_err      OUT VARCHAR2
                                                  , o_return_code     OUT NUMBER
                                                  , p_period_name  IN     VARCHAR2
                                                  , p_nr_livro     IN     NUMBER)
    IS
      CURSOR c1
      IS
    SELECT
              rpad(SUBSTR (gcc.segment1, 1, 2),2,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (emp.de_sgm, 1, 70), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),70,' ')
               || rpad(SUBSTR (gjs.user_je_source_name, 1, 20),20,' ')
               || lpad(DECODE (NVL (gjl.entered_dr, 0)
                        , 0, DECODE (NVL (gjl.accounted_dr, 0), 0, 'C', 'D')
                        , 'D'),1,' ')
               || lpad(TO_CHAR (gjh.default_effective_date, 'DD-MON-YY'),9,' ')
               || lpad(TO_CHAR (gjh.posted_date, 'DD-MON-YY'),9,' ')
               || lpad(SUBSTR (gcc.segment2, 1, 9),9,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (cta.de_sgm, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || rpad(SUBSTR (cta.tp_sgm, 1, 10),10,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_dr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_cr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(SUBSTR (gjh.currency_code, 1, 5),5,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (REPLACE (SUBSTR (gjl.description, 1, 150), '|', '@'), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),150,' ')
               || rpad(gjb.last_updated_by,15,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (gjb.name, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || lpad(SUBSTR (fus.user_name, 1, 30),30, ' ')
                 linha_utl
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041 -- p_nr_livro
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = upper('null') -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
          AND rownum<1001;
          
      CURSOR c2
      IS
        SELECT /*+
             INDEX(GCC GL_CODE_COMBINATIONS_U1)
             INDEX(GJB GL_JE_BATCHES_U1)
             INDEX(FUS FND_USER_U1)
             INDEX(GJL GL_JE_LINES_U1)*/
                    (lpad(TO_CHAR (NVL (SUM(gjl.accounted_dr), 0),'999G999G999G999G999G990D00'),268,' ')) /*VL_DEBITO*/
             ||' '||(lpad(TO_CHAR (NVL (SUM(gjl.accounted_cr), 0),'999G999G999G999G999G990D00'),37 ,' ')) /*VL_CREDITO*/
             ||' '|| TO_CHAR (COUNT (*)) soma /*qtd_reg*/
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = 'null' -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
           
           and rownum<1001;
      w_ind_erro     NUMBER;
      w_erro_geral   EXCEPTION;
    
    
      w_msg_erro     VARCHAR2 (240);
      w_linha        VARCHAR2 (1000);
    
    
      w_nm_arq_utl   UTL_FILE.file_type;
      w_nm_arq_utl_r UTL_FILE.file_type;
    
    
      w_nm_dir_dad   VARCHAR2 (80);
      --w_nm_int_dir_dad VARCHAR2 (80);
      --w_nm_arq_dad   VARCHAR2 (80);
      w_nm_arq_dad_aux VARCHAR2 (80);
      w_nm_arq_dad_qtd VARCHAR2 (80);
      
      P_DIRETORIO VARCHAR2(200) := '/tmp';
      P_ARQUIVO   VARCHAR2(200) := 'Desliga_mainframe_indices_economicos.csv';
      
      W_DIRETORIO VARCHAR2(50) := P_DIRETORIO;
      W_ARQUIVO   VARCHAR2(50) := P_ARQUIVO;
    
    
      w_qtd_reg      NUMBER;
    
    
      -- -----------------------------------------------
    
      PROCEDURE pr_abre_txt --(p_nm_dir IN VARCHAR2, p_nm_arq IN VARCHAR2, p_tp_abertura IN VARCHAR2)
      IS
      BEGIN
        w_nm_arq_utl := UTL_FILE.fopen ( W_DIRETORIO, W_ARQUIVO, 'W');
      EXCEPTION
        WHEN UTL_FILE.invalid_path THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Caminho Invalido');
        WHEN UTL_FILE.invalid_mode THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Modo Invalido');
        WHEN UTL_FILE.invalid_filehandle THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Nome Arquivo Invalido');
        WHEN UTL_FILE.invalid_operation THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Operacao Invalida');
        WHEN UTL_FILE.read_error THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Erro Leitura');
        WHEN UTL_FILE.write_error THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Erro Escrita');
        WHEN UTL_FILE.internal_error THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Erro Interno');
      END pr_abre_txt;
    
    
      -- ------------------------------------------------------
      PROCEDURE pr_grava_txt (p_de_msg IN VARCHAR2)
      IS
      BEGIN
        UTL_FILE.put_line (w_nm_arq_utl, p_de_msg);
      EXCEPTION
        WHEN UTL_FILE.invalid_path THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Caminho Invalido');
        WHEN UTL_FILE.invalid_mode THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Modo Invalido');
        WHEN UTL_FILE.invalid_filehandle THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Nome Arquivo Invalido');
        WHEN UTL_FILE.invalid_operation THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Operacao Invalida');
        WHEN UTL_FILE.read_error THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Erro Leitura');
        WHEN UTL_FILE.write_error THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Erro Escrita');
        WHEN UTL_FILE.internal_error THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Erro Interno');
      END pr_grava_txt;
    
    
      -- ------------------------------------------------------
      PROCEDURE pr_fecha_txt
      IS
      BEGIN
        UTL_FILE.fclose (w_nm_arq_utl);
      EXCEPTION
        WHEN OTHERS THEN
          raise_application_error (-20501, 'ERRO NO FECHAMENTO ARQUIVO DE LOG');
      END pr_fecha_txt;
      -- --------------------------------------------------------------------------------------------------
      BEGIN
      --PR_ABRE_TXT (W_NM_DIR_SQL, W_NM_ARQ_DAD ,'w');
      pr_abre_txt ( W_DIRETORIO, W_ARQUIVO, 'w');
    
    
      w_nm_arq_utl_r := UTL_FILE.fopen ( w_nm_arq_utl, w_nm_arq_dad_qtd, 'w');
     -- w_qtd_reg   := 0;
    
    
     /* FOR cur2 IN c2
      LOOP
        w_linha     := cur2.soma;
        pr_grava_txt (w_linha);
    
    
        w_qtd_reg   := w_qtd_reg + 1;
    
    
        --IF MOD (w_qtd_reg, 100000) = 0 THEN
          UTL_FILE.put_line (w_nm_arq_utl_r, 'Qtd. de linhas geradas = ' w_qtd_reg w_linha );
        --END IF;
      END LOOP;
    
    
     -- UTL_FILE.put_line (w_nm_arq_utl_r, 'Final de Qtd. de linhas geradas = ' || w_qtd_reg);
      UTL_FILE.fclose (w_nm_arq_utl_r);
      --*/
      -- --------------------------------------------------------------------------------------------------
      pr_fecha_txt;
      --
      -- --------------------------------------------------------------------------------------------------
    
    
    
    
    
    
    EXCEPTION
      WHEN w_erro_geral THEN
        raise_application_error (-20501, 'Parada por motivo de Erros na execução.');
    --
    END XXTVGAUDIT;
    

    Oracle Directory object is not OS directory. It is a definition saying Oracle which OS directory to use. When Oracle run

    v_file: = UTL_FILE.fopen ('TMP_DIR', 'output.log', 'W');

    He goes to the data dictionary and:

    1. it checks the Oracle directory object exists tmp_dir

    2. If the Oracle user is allowed to create files on this object directory Oracle (see WRITING privilege granted I posted)

    3 reflects the object of Oracle TMP_DIR for OS directory/tmp directory

    4 creates the file /tmp/output.og owned by OS oracle user with the appropriate permissions on the database server (assuming that OS directory Oracle Directory object points on exists and oracle OS user can create files there).

    Remember, most of the time the OS Oracle user created files permissions are such that the 'others' can even read.

    SY.

  • Verify the existence of the file on the disk does not not (utl_file.fgetattr)

    Hello

    With the help of 11.2.0.3 and have the following code in an attempt to verify the existence of the file.

    Directory and file are certainly and user/schema was the allowance all the specfifed directory for them.

    Another thing to do?

    Wjen, run it says file does not exist - I tried uppare and tiny.

    declare

    v_file_exists BOOLEAN;

    v_file_length NUMBER;

    v_block_size NUMBER;

    Start

    -Create a process to load data to archive

    -A process necessary to run on a regular basis to query the datain.txt_finance_gl table. If an error is triggered which shows that the file is not found then it stops and expected to run next time.

    -If the data is returned, then the data can be queried and loaded into the table in the archive with the relevant number of sequence and datestamp.

    -The txt_load_control will be used to control and verify the transfer.

    -The next sequence in the txt_finance_gl_seq number is obtained as well as current datetime object and create a new entry in the control panel (edc_type will be "GL") and give a working state.

    -At the end of the load, the flat file will be renamed (pre-fixing on the old name, sequence number) and moved to the processed Finance folder.

    -The control panel can then be updated to show the run as it is complete.

    -First check to see if the file already exists on the disk in the box provided.

    UTL_FILE.fgetattr ('big_tab_data', 'testfile', v_file_exists, v_file_length, v_block_size);

    IF v_file_exists THEN

    dbms_output.put_line ("'File Exists");

    ON THE OTHER

    dbms_output.put_line ('file does not exist');

    END IF;

    end;

    user5716448 wrote:

    Location was just prove that the oracle schema user can see the directory and database files.

    create or replace directory BIP_TAB_DATA

    as ' / oracle/finance/export ";

    give all the BIP_TAB_DATA of archiving directory;

    declare

    v_file_exists BOOLEAN;

    v_file_length NUMBER;

    v_block_size NUMBER;

    Start

    UTL_FILE.fgetattr ("BIG_TAB_DATA", "samplefile", v_file_exists, v_file_length, v_block_size);

    IF v_file_exists THEN

    dbms_output.put_line ("'File Exists");

    ON THE OTHER

    dbms_output.put_line ('file does not exist');

    END IF;

    end;

    [BEEP] / finance/export-oracle $ sqlplus archive / pwd @por.sql

    SQL * more: Production release 11.2.0.3.0 the sea Mar 4 16:06:12 2015

    Copyright (c) 1982, 2011, Oracle.  All rights reserved.

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    18.

    PL/SQL procedure successfully completed.

    SQL > set serveroutput on

    SQL > /.

    File does not exist

    PL/SQL procedure successfully completed.

    SQL >

    [BEEP] / oracle/export/finance $ ls-l

    total 1192

    -rw-rw-rw-1 orabip s/n 152953 16 Feb 14:42 weekly sales (SAP) .txt

    -rw - r - r - 1 orabip s/n 49 Mar 04 13:44 afiedt.buf

    -rw-rw-rw-1 orabip s/n 172280 17 February 14:38 new weekly sales (SAP) .txt

    -rw - r - r - 1 orabip s/n 374 Mar 04 16:05 por

    -rw - r - r - 1 orabip s/n 374 Mar 04 16:07 por.sql

    -rw - r - r - 1 orabip s/n 0 Mar 04 16:04 samplefile

    -rw-rw-rw-1 orabip s/n 172280 17 February 14:38 sap_weekly_gl_data.txt

    -rw - r - r - 1 s/n 55 16 Feb 09:52 testfile.bad orabip

    -rw - r - r - 1 orabip s/n 13535 16 Feb 22:00 testfile.log

    -rw-rw-rw-1 orabip s/n 42-16 Feb 09:53 testfile.txt

    -rw-rw-rw-1 orabip s/n 62908 12 February 16:45 test.txt weekly sales

    [BEEP] / oracle/export/finance $

    These two are not even!

  • How to use UTL_FILE to print a JPG image in a CLOB

    I'm using Oracle 11.g.  I have an Oracle Apex application that generates automated emails. In the Apex, the user inserts a JPG image in a rich text field. This image is stored in a CLOB field. When it's time to send emails, Apex calls a stored procedure that reads the JPG image and stores it in a local variable called l_image_clob. The procedure of sending the embedded image with the rest of the body by e-mail to a list of users. (Note: this an embedded image and it is not an attachment). It all works very well.

    Now, I try to save the JPG image content stored in the l_image_clob variable in a JPG file on the server. The server is located on a Windows 7 platform.  The following code generates a file named correctly and the size of the file is correct, but it is not readable by the system. I get the error "is not a valid bitmap file" when I try to open it with Microsoft Paint. The image in the clob data looks something like: / 9j/4AAQSkZJRgABAgEAZABkAAD/4RXaRXhpZgAATU0AKg (a bunch more data) SSSSUpJJJJSkkkklKSSSSU / / Z

    How do I use utl_file to save the JPG image bank in the l_image_clob variable to a valid JPG file?

    -- Here's the code which creates the file that is "not a valid bitmap file"
      -- Create a file based on the content of l_image_clob
      l_image_filename := 'image_' || p_event_pkey || '_' || i ||
      '.' || l_image_ext;
      l_file_handle := utl_file.fopen(l_dirname , l_image_filename, 'wb');
      -- wb is write byte. This returns file handle
      <<inner_loop>>
      for i in 1 .. ceil( length( l_image_clob ) / chnksz )
      loop
      utl_file.put_raw( l_file_handle,
      utl_raw.cast_to_raw( substr( l_image_clob, (i-1) * chnksz + 1, chnksz )));
      utl_file.fflush(l_file_handle);
      end loop inner_loop;
      utl_file.fclose(l_file_handle);

    procedure clobbase642file (p_clob clob, p_dir varchar2, varchar2 p_filename)

    is

    t_buffer varchar2 (32767).

    number of t_pos: = 1;

    number of t_size: = nls_charset_decl_len (32764, nls_charset_id ("char_cs"));

    number of t_len;

    t_fh utl_file.file_type;

    Start

    t_fh: = utl_file.fopen (p_dir, p_filename, "wb", 32767);

    t_len: = length (p_clob);

    loop

    When the t_pos output > t_len;

    t_buffer: = replace (replace (substr (p_clob, t_pos, t_size), Chr (10)), Chr (13));

    t_pos: = t_pos + t_size;

    all in t_pos <= t_len="" and="" mod(="" length(="" t_buffer="" ),="" 4="" )="">0

    loop

    t_buffer: = t_buffer | Replace (replace (substr (p_clob, t_pos, 1), Chr (10)), Chr (13));

    t_pos: = t_pos + 1;

    end loop;

    UTL_FILE.put_raw (t_fh, utl_encode.base64_decode (utl_raw.cast_to_raw (t_buffer)));

    end loop;

    UTL_FILE.fclose (t_fh);

    end;

  • Utl_File or standard coil

    Hi all

    I have a table that contains data of round 1, 11, 23, 456 files I need to export to a flat file (.txt) with a ' |' delemiter.

    Please let me know which is the best way to use utl_file mechanism or standard coil (in terms of performance).

    Thank you

    UTL_FILE is an operation of e/s side server on the server's file system.

    COIL is a SQL * more the client operation I/O on a file system of the client.

    Two very different things.

  • UTL_FILE other line Terminator with implementation

    I want to have a different line terminator than LF + CR on a Sun-Unix System DB 10R2.

    It works very well with this procedure, if I have a constant string like "Hello."

    But when I use this slider, he always writes an empty file on the directory.

    I can increase the buffer to 32767, but nothing helped.

    I can empty the buffer after writing all records, but nothing helped.

    What I did wrong. I'm desperate, really. Can anyone help please and fast!

    Thanks a lot for Bea

    ################################################################

    PROCEDURE PRC_WRITE_EO_WHS_WHS (p_dir IN VARCHAR2) IS

    CURSOR c_whs IS

    SELECT char_rpad (WAREHOUSE_CODE, 3) | Filler('', 19) |

    num_LPAD ((available_stock * 100), 9) | Filler('', 18) |

    num_LPAD (QTY_NEXT_DELIVERY * 100, 9) |

    num_LPAD (to_char (date_next_delivery, 'YYYYMMDD'), 8).

    Filler('', 5) | num_LPAD ((QUANTITY_MIN * 100), 9) |

    num_LPAD ((QUANTITY_INTERVAL * 100), 9) | Filler('', 6) |

    char_rpad (current_prod_code, 30) AS my_rec

    Of exp_eo_whs_whs_1_v;

    -WHERE rownum < 101; -trial;

    ID UTL_FILE. TYPE_DE_FICHIER;

    NAME_EO VARCHAR2 (50): = "ZWHS0001";

    NAME VARCHAR2 (50): = NAME_EO | '_' || "WHS_WHS01_" |

    TO_CHAR (SYSDATE, 'YYYYMMDD_HH24MISS'). ".txt";

    ERR VARCHAR2 (4000);

    NUM NUMBER;

    v_rec VARCHAR2 (4000);

    v_DIR VARCHAR2 (30);

    BEGIN

    IF p_dir = "P".

    THEN

    v_DIR: = 'ECTMP_TEST ';

    ON THE OTHER

    v_DIR: = 'ECTMP_TEST ';

    END IF;

    ID: = UTL_FILE. FOPEN (v_DIR, NAME, "w");

    IF UTL_FILE.IS_OPEN (id)

    THEN

    DBMS_OUTPUT. Put_line ('Opened');

    ON THE OTHER

    DBMS_OUTPUT. Put_line ("' still closed");

    END IF;

    FOR satz IN c_whs

    LOOP

    v_rec: = satz.my_rec;

    UTL_FILE. PUT (id, CONVERT (v_rec, 'WE8EBCDIC37', 'WE8MSWIN1252'));

    UTL_FILE. PUT (id, chr (37));

    -UTL_FILE. NEW_LINE (id, 0);

    -UTL_FILE. FFLUSH (ID);

    END LOOP;

    UTL_FILE. FCLOSE (ID);

    DBMS_OUTPUT. Put_line ("Successful write to the file '");

    EXCEPTION

    WHILE OTHERS THEN

    Err: = SQLERRM;

    NUM: = SQLCODE;

    DBMS_OUTPUT. Put_line (Err);

    DBMS_OUTPUT. Put_line (num);

    DBMS_OUTPUT. Put_line ('error in writing to the file');

    END PRC_WRITE_EO_WHS_WHS;

    Are you sure that the SELECT you wrote in the CURSOR returns data?

  • UTL_FILE get_line help update records

    DECLARE

    v_random_no varchar2 (12);

    v_random_no1 varchar2 (12);

    -File Variables

    file_out UTL_FILE. TYPE_DE_FICHIER;

    ftell UTL_FILE. TYPE_DE_FICHIER;

    l_dir_path varchar2 (100): = ' / u02/app/dtc/outgoing_data/lc_5050 /';

    v_rec_cnt number;

    BEGIN

    Dbms_output.put_line ('Time beginning of Script DML' |) TO_CHAR (SYSDATE, "DD/MM/YYYY HH24:MI:SS"));

    v_rec_cnt: = 0;

    IF this is utl_file.is_open (file_out) then

    file_out: = utl_file.fopen (l_dir_path, 'subbu.txt', 'r');

    -file_out: = utl_file.fopen (l_dir_path, 'IDs_sq9416_RESPIMAT6967LS_grp6967_cnt117335_typePATIENTSTARTERKIT_10152014.txt', 'r');

    END IF;

    LOOP

    BEGIN

    UTL_FILE.get_line (file_out, v_random_no);

    Dbms_output.put_line (' documents updated :'|| no. v_random_no);

    Update dtc_opc_random_no

    SET attribute01 = 'PATIENT STARTER KIT'

    WHERE attribute01 = 'OFFICE '.

    AND org_prog_cam_id = 6967

    AND random_no = v_random_no;

    Dbms_output.put_line (' documents updated :'|| no. v_random_no);

    v_rec_cnt: = v_rec_cnt + Sql % rowcount;

    IF MOD(v_rec_cnt,50000) = 0

    THEN

    COMMIT;

    END IF;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    EXIT;

    END;

    END LOOP;

    UTL_FILE. FCLOSE (file_out);

    Dbms_output.put_line (' documents updated :'|| no. v_rec_cnt);

    Dbms_output.put_line ('End time of Script DML' |) TO_CHAR (SYSDATE, "DD/MM/YYYY HH24:MI:SS"));

    END;

    /

    I have the script above I have 4 files in subbu.txt file iam trying to update not only one record day

    SELECT * from dtc_opc_random_no

    WHERE org_prog_cam_id = 6967 AND attribute01 = 'OFFICE' and random_no in ()

    618062382,

    618062435,

    618062443

    ) 3 records exist in most high why it is updated only a record can u help me please

    DML Script start time: 13/11/2014 06:24:40

    Not record update: 618062382

    Not record update: 618062435

    Not record update: 618062443

    Not update files: 0

    End time of DML Script 13/11/2014 06:24:40

    PL/SQL procedure successfully completed.

    And you are sure that you don't have any space around the 'numbers' in your table or in your input file?

  • Getting ORA-29280: directory path invalid as he tried to call utl_file

    I've seen a lot of posts on this, but none of the suggestions work. I tried many variations of the following and I pretty much get the same error on different lines. See below for the error.

    My code is as follows:

    CREATE or REPLACE DIRECTORY LOAD_SRC as 'C:\Stuff\BulkInsert ';

    -Select * from all_directories where directory_name = "LOAD_SRC"; C:\Stuff\BulkInsert is in the list

    DECLARE

    sale_amount NUMBER;

    LOAD_SRC VARCHAR2 (50); -If I do not add it I get the following msg: PLS-00201: identifier 'LOAD_SRC' must be declared

    FILE_HANDLE utl_file.file_type;

    BEGIN

    FILE_HANDLE: = utl_file.fopen (LOAD_SRC, 'stuff.dat', 'W', 256);--29280. 00000 - "invalid directory path.

    Sum (sale_amount) SELECT INTO sale_amount OF POS_RECORD; - where sale_amount like '% ';

    UTL_FILE.put_line (FILE_HANDLE, sale_amount);

    UTL_FILE.fclose (FILE_HANDLE);

    END;

    /

    @@@@@@@@@@@@@@@@@@@@@@@

    Error:

    CREATE or REPLACE DIRECTORY succeeded.

    Error from line 3 in order:

    DECLARE

    sale_amount NUMBER;

    LOAD_SRC VARCHAR2 (50); -If I do not add it I get the following msg: PLS-00201: identifier 'LOAD_SRC' must be declared

    FILE_HANDLE utl_file.file_type;

    BEGIN

    FILE_HANDLE: = utl_file.fopen (LOAD_SRC, 'stuff.dat', 'W', 256);--29280. 00000 - "invalid directory path.

    Sum (sale_amount) SELECT INTO sale_amount OF POS_RECORD; - where sale_amount like '% ';

    UTL_FILE.put_line (FILE_HANDLE, sale_amount);

    UTL_FILE.fclose (FILE_HANDLE);

    END;

    Error report:

    ORA-29280: invalid directory path

    ORA-06512: at "SYS." UTL_FILE", line 41

    ORA-06512: at "SYS." UTL_FILE", line 478

    ORA-06512: at line 6

    29280 00000 - "invalid directory path.

    * Cause: A corresponding directory object does not exist.

    * Action: Correct the parameter object directory, or create a correspondent

    object directory with the command CREATE a DIRECTORY.

    Is C:\Stuff\BulkInsert on your Oracle database server?

    In addition, FILE_HANDLE: = utl_file.fopen(LOAD_SRC,'stuff.dat','W',256); ==> FILE_HANDLE: is utl_file.fopen('LOAD_SRC','stuff.dat','W',256);. If you declare a varriable put this string into that and then refer to your code.

  • UTL_FILE incite the error on parsing

    Hello Sir/Madam,

    Please tell me why encourage the joint Pl/SQL procedure "PLS-00382: expression is of the wrong type" error when I am using UTL_FILE in read option to analyze flat data file.

    Sample DATA:

    055004419002 JAMES SMITH of WEILERS BND 2014071011355433016 X 7XLKO 13669288 gas leak found and corrected...   Necessary duct tape...


    055008490009 X 16959247 7XLKI 201407101129543302112 OTHOSON AVE JOHN SMITH without leakage is the location...


    055011684341 X 17581401 7XHIT 201407101137543302705 BARDELL Dr. JOHN SMITH confirmed line kick... Secure... Need to flight crew r/p.

    I appriciate your help.

    Kind regards

    Vani

    > v_acctno: = substr(DATA,1,12);

    Don't know why you would try this until you can read the file, but it is.

    Guess the data type of v_acctno, I don't think CLOB will be implicitly converted to NUMBER, try to use TO_NUMBER.

  • UTL_FILE import csv file

    Hello

    I am writing a procdeure use the utl_file.get_line to read csv files and then proceed to a treatment before inserting data into a table.

    The csv file has four columns. The third column data have a newline when reading the file I get an error value.

    The procedure cannot detect the length of the 3rd field, it cannot detect the 3rd decimal point because this column has a line break.

    To differentiate the length of the column between each ',' part of the code I use is below.

    BEGIN

    Starts: = UTL_FILE. FOPEN ("D:\TEST','CT. CSV', 'R', 32765);

    loop

    UTL_FILE. GET_LINE (starts, input_String);

    delChar varchar2 (1): = ', ';

    -first field
    v_Pos: = instr (input_String, delChar, 1, 1);
    v_lenString: = v_Pos - 1;
    v_compname: = substr(input_String,1,v_lenString);

    v_startPos: = v_Pos + 1;

    -This will get the second field
    v_Pos: = instr (input_String, delChar, 1, 2);
    v_lenString: = v_Pos - v_startPos;
    v_comptype: = substr (input_String, v_startPos, v_lenString);

    v_startPos: = v_Pos + 1;

    -3rd field
    v_Pos: = instr (input_String, delChar, 1, 3);

    v_lenString: = v_Pos - v_startPos;
    v_notes: = substr (input_String, v_startPos, v_lenString);


    v_startPos: = v_Pos + 1;
    -the last land - there is no delimiter for last field
    v_Pos: = length (input_String) + 1;
    v_lenString: = v_Pos - v_startPos;
    v_comptypemodel: = substr (input_String, v_StartPos, v_lenString);

    My csv file looks like this when it is open with notepad ++,.

    CA COOLER VSM 89 E, MSM 89 E, 'EL. AC-MOTOR UNITS.

    ABB WADA 500L2L BSMH 11000V/1720KW/105 A/3584 RPM 60 HZ S1
    COOLING WATER FLOW 12.3 m3/h
    AMBIENT TEMP. 45 DEG", 123421
    ABB WADA 500L2L BSMH 11000, V/1720KW/105 A/3584 RPM 60 HZ, EL S1. AC-MOTOR UNITS. ABB WADA, EL. AC-MOTOR UNITS.

    The value of v_pos = 0 and v_lenSting =-30 for the 3rd field.

    Hope someone can point me in the right direction on how to solve this problem.

    Thanks in advance.

    OK, my apologies, I don't see the real problem you're trying to solve in the first post (it helps us if you format code / data using a font courier etc. in the Advanced Editor)

    Here is the response from Tom Kyte...

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:2818047000346046084

    While there is an option in 11 GR 2 from an external preprocessor allows to process the file (which can be useful for files of decompression etc - see pretreatment: preprocess external Tables) it will probably not help in your case, because you will not easily be able to determine what 'new line' characters to substitute something else for you to make the difference when loading the data.

    Creating the CSV data can be modified to replace the line break characters in text by something else?  or use a different delimiter to the end of line?  That would be the ideal solution.

Maybe you are looking for

  • Equim L350D - 11 d boot more

    I had uninstalled Mcafee Internet security 2 weeks ago to install Trend Micro (it was free of my ISP) and have had problems since. It started with a software conflict so I uninstalled the software and the laptop has continued to function properly, bu

  • connect the printer to the network

    I can't understand how to connect the HP Deskjet 3070 B611a printer to my wireless network. Cannot find where to insert the name of the network etc. It works perfectly with cable connection. I downloaded software printing for Mac air, nothing happene

  • Notepad has lost all the style of format, depending on the size

    Toolbar is missing on my Microsoft Windows XP. I can still copy and paste, write and record but cannot format, change the font size, style etc. I also found a folder My Favorites. It is a file and not a Web site. I don't think it belongs there. The n

  • HP envy23 tilt everything in an upgrade of windows 8 for windows 8.1 with error

    With a little help from my friends. I have this brand new envy23 tilt all - in - one with windows 8. I perform all the latest updates. Now, I want to update the system to win 8.1 but fails. I get this error 0xc1900101 - 0 x 40019 Whenever the system

  • Error number: 0x800CCC0D when trying to email

    I get this error when you try to e-mail. The host 'smtp' could not be found. Please check that you have entered the server name correctly.Object ", account: 'pop3', server: 'smtp', Protocol: SMTP, Port: 25, secure (SSL): no, Socket error: 11001, erro