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.

Tags: Database

Similar Questions

  • Download and copy the files using PLSQL.

    Hi all

    Can the package UTL allows you to download any file data local to the server?
    Or is it an integrated package that can be used to upload files to the server and copy files to another directory?

    Thanks in advance.

    Benoit says:

    Can the package UTL allows you to download any file data local to the server?

    UTL_FILE is standard file i/o.

    Or is it an integrated package that can be used to upload files to the server and copy files to another directory?

    UTL_TCP provides a tcp socket interface client. This can be used as an FTP client. Utl_http provides a web browser client-the box of files can also be sent by e-mail with UTL_SMTP and UTL_MAIL.

    You should also ask if the code from PL/SQL Server acting as a client to push a file to a server, adapts the architecture of the application at hand.

  • Limit the control panel and IE for the Standard user account

    I'll set up a new computer for a 91 year old customer in a retirement home, who don't use the computer for e-mail and an occasional Wordpad document.  His son wants to put computer in place so that it cannot get to the Internet Explorer browser, or go to control panel, because he bumbles around the keyboard causing all sorts of problems requiring frequent service for me calls.

    The operating system is Windows Vista Home BASIC, so gpedit.msc is not installed.  I have activated the system administrator account for my use when I am called to repair the computer and set the Standard user to user account.  The problem is that the only way I found to disable IE and the Control Panel causes them be turned off in BOTH accounts.  I wish I could disable them ONLY in the user account.

    The only solution I found to disable the control panel is a registry hack in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current versionpolicies where I put a DWORD 32-bit "NoControlPanel" with a value of 1.  I tried to do that in the HKEY_CURRENT_USER hive, but it had no effect.  This kind of work, but there are two problems then; Mises_a_jour Windows 1) won't install and 2) when I have to go to work on the computer, I first change administrator user, then change the DWORD value to 0 and finally to restart the computer, causing additional assignments, lengthen my time at work.

    Second, the only solution I could find to disable IE was in the default protrams Panel, which disables the administrator as well.

    Can someone tell me if there is another way to achieve this, while IE and control panel are disabled only for the user?

    Change the security to the IE executable rights? Remove 'Users', while you keep the administrator rights.

    For control panel see 'Method Two' in this link:

    http://www.Vistax64.com/tutorials/120951-Control-Panel-show-specific-icons-only.html

    "creacontech" wrote in the new message: * e-mail address is removed from the privacy... *

    Thanks for your response, but will not solve problem of this "gentleman". The object is not so much to limit internet access, as it should restrict access to programs.  He is 91 years old, has small hands and types rapidly with two fingers, but made many mistakes.  Disability is before everything to prevent clikety snap everywhere, because he creates sort of a zillion copies shortcuts of the webpage on his desk, until everything hangs and I have to go a push up on his mess. The same reason applies to the Contorl Panel.  We don't want it to be able to get to the Panel "printers."  When a document will not be printed for a reason, he go, dummy click around and created a bunch of copies of the printer, with a gazillian of documents clogged up in the queue of the coil.  I had to cclear up to 100 documents from the spool on 50 copies printer queue.  It's really an economic problem for his son.

  • 4200 exempts no paper when the tiroir2 is set to standard

    Hello

    I have LaserJet 4200, which raises the paper when the selector on tray 2 is in the custom position, but does not throw when the selector is set to Standard. From what I see when you switch selector in Standard or custom, the only difference is the three bars in plastic on the side of the status bar engaged three contacts in the printer when the tray is in. When the tray is in Standard mode, only the contact in the middle is engaged.

    I'm not sure if it's the average contact in the printer that is inoperable, or maybe the coil in the engine of the elevator that is connected to the central contact. And I can't find anything on the replacement of the elevator tray 2 on the web engine.

    Help, please.

    Thank you.

    For the printer, I pulled the tiroir2 out and played with the contacts of three tray on the side of the printer, by pushing brake, he seems to have an effect of resetting this switch, and so far it raises the tray very well...

  • 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.

  • JOURNAL of COIL RMAN

    Hello

    10.2.0.3 on Win 2003 server.

    When I run the following manually it works well and the output is written to the sppol file:

    JOURNAL of the COIL to "D:\SCRIPTS\Scripts\backup\Test_log_MyDB.txt".

    run

    {

    View all;

    }

    COIL DISCONNECTION;

    But when run from a file of commands like follow the hold file is created but empty:

    =================BATCH=========================

    Define WORK_DIR = % ~ dp0

    Set ORACLE_SID = MYDB

    RMAN nocatalog target / @Test.sql

    = END OF BATCH =.

    Thank you.

    Try

    RMAN nocatalog target / @Test.sql log='D:\SCRIPTS\Scripts\backup\Test_log_MyDB.txt'

    See cmdLine where you can read

    LOG='filename' Specifies the file where RMAN records its output, that is, orders that were processed and their results. If you do not specify this argument, then RMAN writes its file on the standard output message log.

    Note: remove commands of the coil of your file.

  • UTL_FILE directory server side

    Hi all

    Maybe the expert developers can help me?

    DB = 11.2.0.3

    Is there a way the dir utl_file in mobile customer output folder? Given that the server side is in the CLOUDS, and for safety reasons users are not allowed to access the cloud servers.

    Someone advised to use a 'java stored proc? Have you heard of it? It seems, it is the industry standard and is the solution used by the developers of EBS Suite products.

    Any ideas?


    Thank you very much

    Kinz

    KinsaKaUy? wrote:
    It is because of the limitation of PL/SQL, only not to be able to write to the client folder? or am I lost?

    The database server can not literally see your desktop. This has nothing to do with PL/SQL, it's to do with network and security protocols. The client connects to the server, not the other way around.

    Java in the database has the same restriction. It's just that your site, someone has hit up a JSP page that uses a low level such as FTP protocol to work around this problem. They could have done the same thing with PL/SQL, but has not wanted (or didn't know they can), or more likely they just re-designed an existing piece of code Java.

    Cheers, APC

  • difference btw utl_file and dbms_lob

    Hello

    What is the difference with utl_file, dbms_lob, doing the same file acess or difference?

    797525 wrote:

    What is the difference with utl_file, dbms_lob, doing the same file acess or difference?

    UTL_FILE is a PL/SQL package that provides a PL/SQL code with the operating system standard interface IO. You will find this same interface in languages like C, C++, Pascal, PHP, Perl, and others.

    DBMS_LOB is a PL/SQL package that allows you to manage an Oracle LOB data type. This data type is 'special' that it can contain objects of large data (such as video, sounds, images, documents, spreadsheets, etc.).

    Technically speaking, there is very little that is the same between the two.

    Conceptually, the two are however, interfaces 'files '. The only difference is that the files of UTL_FILE , external access (on the file system of the operating system). Whereas the DBMS_LOB provides the ability to create and store and manage "files" directly in the database. (there are also a BFILE data type that resembles a LOB, but is actually an external file)

    It's rarely a good idea to get out of the database in a file system of an operating system with UTL_FILE. There are problems of security and access control. Concurrency issues and transactions. Problems with the integrity of the data. Problems with the backup of the data. Etc.

    So, in general, when you're dealing with the concept of "+ files +" in Oracle, you should look at first using the Oracle database itself - and deal with files like LOBs using DBMS_LOB.

  • error with utl_file for user... !

    SET OF BUFFER 1000000
    SET SERVEROUTPUT ON
    coil LMG_DBmigration_log.log
    Declare
    V_File UTL_FILE. TYPE_DE_FICHIER;
    V_Dir VARCHAR2 (4000);
    V_Filename VARCHAR2 (2000);
    BEGIN
    V_Dir: = "DATAMIGRATION";

    DBMS_OUTPUT. Put_line ('start...');

    v_filename: = 'LMG_DBmigration_out.txt ';
    V_File: = UTL_FILE. FOPEN (v_dir, v_filename, 'w');

    DBMS_OUTPUT. Put_line ("open file... '");

    UTL_FILE. Put_line (V_File, 'hey..');
    UTL_FILE. Put_line (V_File, 'I am pc...');

    UTL_FILE. FCLOSE (v_file);
    EXCEPTION
    WHILE OTHERS THEN
    DBMS_OUTPUT. Put_line ("an unexpected error: ' |") substr (SQLERRM, 1, 100));

    End;
    /

    spool off
    pause
    "exit";
    ------------------------------------------------------------------------------------------

    When running command, I get error like below...

    sqlplus co/co@LMGCO AS SYSDBA @Test_UTL.sql

    o/p-

    beginning...
    Unexpected error: ORA-29283: invalid file operation
    ORA-06512: at
    'SYS. UTL_FILE", line 488
    ORA-29283: invalid file ope

    PL/SQL procedure successfully completed.
    ------------------------------------------------------------------------------------------

    kindly help me, if there is no problem with the question of privilege user, then please erase me how to fix it...

    Published by: PC on November 26, 2010 05:56

    >
    Yes... "D:\test_co" exists in the local computer and I connect to another server with the help of tnsname.ora
    >
    This is the reason why you get the error message. Oracle search folder "D:\test_co" of the computer server database and not from your local computer.

    You must go to the "172.18.86.10" computer and see what records there. If necessary create a folder "\test_co" somewhere in this remote computer. Then your code wil lstart of work afterwards and folder is created on the remote computer, not on your local computer.

  • UTL_FILE for another server, how

    Hello
    Anyway is it easy to write with utl_file Oracle MS file on another server? I rea on some Java applets for that but maybe there is something try that. I have no html, xls, xml, or whatever it is a txt file flat simply with a formatting, kind of report.

    I'm just learning that utl_file can write on the database server, not the client. In my case I have to create the file and send it as a result of customer and looks all DBAS don't like make files on the server of the Ora, this is common?

    All TX

    Trent

    Trento wrote:

    Anyway is it easy to write with utl_file Oracle MS file on another server?

    DBMS_FILE_TRANSFER for the Oracle server to the Oracle server copies files.

    Between an Oracle server and a non-Oracle server, there are two methods:
    -ftp
    sftp/scp
    -Samba (Windows network drive/CIFS mappimg)
    -NFS (network file share)
    -rdist (cable - sync'ing a directory of remote server to reflect a local)

    The "+ best +" one of them would be sftp/scp because it is one of the most secure interfaces. Rdist can be run using the scp.

    I'm just learning that utl_file can write on the database server, not the client.

    Fix. And that's the word limitation UTL_FILE . All the entries of file on any platform is possible only for local file handles. There is a way to write to a remote file not magically... Consider the standard appeal fopen() taken I/O supported by the majority of the nuclei.

    In my case I have to create the file and send it as a result of customer and looks all DBAS don't like make files on the server of the Ora, this is common?

    Stupidity of your DBA IMO.

    We stock a large number of text files (output of command line of devices containing configuration data), the CSV files and XML as CLOB files in Oracle. We generate also "files" as a CLOB in Oracle - using the database in the main storage for these 'files '. Delivery of these 'files' (stored as a CLOB) are usually via http (via WPG_DOCLOAD) or via ftp/sftp/scp (using custom PL/SQL packages).

  • The "permanent" that come with the Nike watch complications on standard watch faces?

    The "permanent" that come with the Nike watch complications on standard watch faces?  I see this question has been asked before, but not yet received response - did someone know the answer please?

    No one has a new watch. They will not be shipped before seven. 16. then go to your local store to get an answer to your question.

  • Re: Font book. I chose "restore standard fonts" by mistake. How to get back on my choice. The Cancel button is grayed out so I can't cancel it. Any suggestions? Thank you!

    Re: Font book.

    I chose "restore standard fonts" by mistake. How to get back on my selection. The Cancel button is grayed out so I can't cancel it. Any suggestions? Thanks in advance!

    If you click on 'Restore the standard fonts', fonts that are not included in the OS X systems is placed in a "fonts folder (deleted) next to the fonts folder.

    / Library/Fonts

  • iTunes Foto Mediathek standard not shown

    Hello! iTunes does not show the standard foto mediathek in ' copy of fotos of. " Only records are available. What can I do to change ist "Fotos", which is shown as standard on all other MacBook?

    I ve got: you must mark "foto-mediathek" in Fotos to the 'system' in 'Einstellungen'... :-)

  • Finder works is not in standard account

    I hope that this community can provide assistance that I have a lot of luck with Google so far.

    So basically, I created another standard account that has no control admin on my MacBook Pro with the intention to use it for daily use. However when I log on the standard account Finder just will not work.

    I tried to remove the apple Finder plist and restarted without result.

    Can anyone offer some ideas on how I can fix this?

    What exactly happens when you try to use the Finder?

  • My Firefox has lost all the standard tabs and search is no longer using Google?

    Today, my former excellent Firefox all lost it's memory. My standard tabs in the top bar are all gone. He constantly only to search in Yahoo, I hate. I want to like it was yesterday. I want that all my tabs back and I want it to look using Google. I tried to set up an account and Sync, but anything doesn't work as it keeps going back to a new start empty without tabs and Yahoo search.

    Look at your desktop. You see a folder called; Old Firefox?

    https://support.Mozilla.org/en-us/KB/recovering-important-data-from-an-old-profile

    https://support.Mozilla.org/en-us/KB/back-and-restore-information-Firefox-profiles

Maybe you are looking for