Written by UTL_FILE Package

I write a PL/SQL code to extract data from query select via cursor & write output to a CSV file.

PL/SQL code is as below.

serverout Set size 1000000

Set serveroutput on

ALTER session set nls_date_format = 'YYYY-MM-DD ";

CREATE or REPLACE DIRECTORY MY_FILE_DIR AS ' / usr/tmp2;

DECLARE

file_name varchar2 (100): = "Emp_Data";

file utl_file.file_type.

TYPE no IS RECORD)

v_empno varchar2 (10),

v_last_name varchar2 (40)

);

cursor PnJD_cur is

Select employee_number, last_name

of apps.zshr_employee_v one

where a.user_person_type = '01'

and a.EFFECTIVE_END_DATE ='4712-12-31';

BEGIN

IF this is PnJD_cur % ISOPEN THEN

PnJD_cur OPEN;

ENDIF;

Look FOR PnJD_cur IN SheikYerbouti;

While PnJD_cur %

LOOP

file: = utl_file.fopen (MY_FILE_DIR, file_name |'.) CSV', 'w');

UTL_FILE.put (file, emp_rec.v_empno |) ',' ||

emp_rec.v_last_name

);

UTL_FILE.fclose (file);

-dbms_output.put_line (file: '.) CSV');

Look FOR PnJD_cur IN SheikYerbouti;

END LOOP;

END;

I believe that this code "beautifully" written in the csv file, but it didn't. Rather, there was an output like below. In the end, I had to do CTRL + C to stop execution.

In this regard, any HELP is APPRECIATED. Thank you in advance.

SQL > @EMP_Personal_Job_Data_Extract1123

Modified session.

Created directory.

37

38

39

40

41

42

43

44

45

46

47

48

49 50

51

52

53

54

55 ^ C

SQL >

Hey,.

Instead of TYPE & OPEN, FETCH, CLOSE cursor, try this simple LOOP FOR cursor that is mentioned below, unless you have a specific requirement to use these commands.

serverout Set size 1000000

Set serveroutput on

ALTER session set nls_date_format = 'YYYY-MM-DD ";

CREATE or REPLACE DIRECTORY MY_FILE_DIR AS ' / usr/tmp2;

DECLARE

file_name varchar2 (100): = "Emp_Data";

file utl_file.file_type.

cursor PnJD_cur is

Select employee_number, last_name
of apps.zshr_employee_v one

where a.user_person_type = '01'

and a.EFFECTIVE_END_DATE ='4712-12-31';

BEGIN

file: = utl_file.fopen (MY_FILE_DIR, file_name |'.) CSV', 'w');

FOR v_pnjd IN PnJD_cur

LOOP

UTL_FILE.put_line (file, v_pnjd.v_empno |) ',' || v_pnjd.v_last_name);

END LOOP;

UTL_FILE.fclose (file);

END;

The above code is based on the principle that you want to recover the data and put them into the same file (Emp_Data.csv).

Tags: Database

Similar Questions

  • run the UTL_FILE package

    declare

    utl_file.file_type F1.
    Start

    F1: is UTL_FILE.fopen ('UTL1', 'example1.txt', 'w');.

    UTL_FILE.put_line (F1, 'hello');
    UTL_FILE.put_line (F1, 'welcome');
    UTL_FILE.put_line (f1, "this is the example to use utl_file package system");
    end;

    After the execution of this file is created with the specified name in the specified location.
    but the text is not inserted into the file.
    What is the reason and how can I solve this problem?

    You forgot to fclose

  • Get the filename with utl_file package

    Hello

    I'm running on oracle version 10.2.0.3.0.
    Are there opportunities scan the oracle Center and get all the file names in plsql table using the utl_file package?


    Thank you!

    Cann't do you with UTL_file, you use java or other external language. as

    create or replace type List as table of   varchar2(255);
    /
    
    create or replace and compile java source named "FileList"
    as
    import java.io.*;
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    
    public class FileList
    {
       public static ARRAY getList(String directory) throws SQLException
       {
           File path = new File( directory );
           Connection conn =
                 new OracleDriver().defaultConnection();
           ArrayDescriptor descriptor =
             ArrayDescriptor.createDescriptor( "LIST", conn );
           return new ARRAY( descriptor, conn, path.list() );
       }
    }
    /
    
    CREATE OR REPLACE FUNCTION  GETFILES_FUN( DIR_PATH_V VARCHAR2)   return List
    AS language java name 'FileList.getList(java.lang.String )
              return oracle.sql.ARRAY.ARRAY';
    /  
    
    select *     from TABLE ( cast (GETFILES_FUN( 'c:\\' ) as List) );
    

    Concerning
    Singh

  • ORA-03123 during the use of formulas of UTL_FILE package in oracle 10g

    Hi all
    I have created a 'REPORTS' as 'E:\EXCEL_TESTING_FORM\' directory and to grant read, write to this directory at scott.
    and also a given grant execute on UTL_FILE to scott;

    I wrote this code in a trigger pressed the button and my file name is the file somename.xls

    After printing the first line as 7369SMITH3000 in a single cell when it goes to print the second employee record is to show
    ORA-03123 inside the loop.

    CURSOR EMP_DATA IS
    SELECT * FROM SCOTT. EMP;

    C_REF EMP_DATA % ROWTYPE;
    L_FILE UTL_FILE. TYPE_DE_FICHIER;
    V_PATH VARCHAR2 (200): = ";

    BEGIN

    V_PATH: = "REPORTS";
    L_FILE: = UTL_FILE. FOPEN (V_PATH, P_FILE_NAME, 'W');

    EMP_DATA OPEN;

    LOOP
    EXTRACT THE EMP_DATA IN C_REF;
    WHEN THE OUTPUT EMP_DATA % NOTFOUND;

    UTL_FILE. PUT_LINE (L_FILE, TO_CHAR (C_REF. EMPNO));
    UTL_FILE. PUT_LINE (L_FILE, C_REF. ENAME);
    UTL_FILE. PUT_LINE (L_FILE, TO_CHAR (C_REF. SAL));

    END LOOP;
    CLOSE EMP_DATA;

    UTL_FILE. FFLUSH (L_FILE);
    UTL_FILE. FCLOSE (L_FILE);

    Please guide me how to avoid this error and also how to print cell wise why because it's printed in a single cell.

    Please answer...

    What is a network drive? If so, try if the same code is running on a local directory, maybe the network drive is smehow is not accessible.

  • Problem using ORA-29285 UTL_FILE package

    Dear all,

    I would appreciate your help.
    I am trying to export data, form a table.
    The DB version is 10.2.0.4
    I use the following procedure:
    create or replace
    procedure EXPORT_FRAME(
    dir IN VARCHAR2, filename IN VARCHAR2) IS
    f utl_file.file_type;
      cursor frame is 
        Select *
        from test_complete_frame_2008;
    
    begin 
    
      f:= utl_file.fopen (dir, filename,'w');
      FOR a IN frame
      Loop 
        utl_file.put_line (f,
            
            '"'||a.COM_DATA_ID || '";"' ||
               a.COM_DATA_SET_ID || '";"'||
                a.NSI || '";"'||
                a.FRAME_ID || '";"'||
                a.STATUS_FRAME || '";"'||
                TO_CHAR(a.FRAME_REFERENCE_DATE, 'dd/mm/yyyy') || '";"'||
                TO_CHAR(a.DATE_OF_SELECTION, 'dd/mm/yyyy')  || '";'||
                a.EU_LEU_ID || ';"'||
                a.NSA_ID || '";"'||
                a.SOURCE_IDENTITY || '";"'||
                TO_CHAR(a.REF_DATE_LEU_IDENTITY, 'dd/mm/yyyy') || '";"'||
                a.NATIONAL_ID || '";"'||
                a.REF_DATE_NATIONAL_ID || '";"'||
                a.DUNS_NUMBER || '";"'||
                TO_CHAR(a.REF_DATE_DUNS_NUMBER, 'dd/mm/yyyy') || '";"'||
                a.BVD_ID || '";"'||
                TO_CHAR(a.REF_DATE_BVD_ID, 'dd/mm/yyyy') || '";"'||
                a.NAME_LEGAL_UNIT || '";"'||
                a.LEGAL_FORM_EGR || '";"'||
                a.SOURCE_LEGAL_FORM || '";"'||
                TO_CHAR(a.REF_DATE_LEGAL_FORM, 'dd/mm/yyyy') || '";"'||
                a.TYPE_OF_LEGAL_UNIT || '";"'||
                a.SOURCE_CODE_TYPE_OF_LEU || '";"'||
                TO_CHAR(a.REF_DATE_TYPE_OF_LEU, 'dd/mm/yyyy') || '";"'||
                a.STATUS_LEU || '";"'||
                a.SOURCE_CODE_STATUS_LEU || '";"'||
                TO_CHAR(a.REF_DATE_STATUS_LEU, 'dd/mm/yyyy') || '";"'||
                a.POST_DELIVERY_POINT || '";"'||
                a.CITY_NAME || '";"'||
                a.POSTAL_CODE || '";"'||
                a.STATE_NAME || '";"'||
                a.COUNTRY_CODE_BOP || '";"'||
                a.COUNTRY_ACCESS_CODE || '";"'||
                a.TELEPHONE_NUMBER || '";"'||
                a.FAX_NUMBER || '";"'||
                TO_CHAR(a.DATE_OF_INCORPORATE, 'dd/mm/yyyy') || '";"'||
                a.SOURCE_DATE_OF_INCORP || '";"'||
                TO_CHAR(a.REF_DATE_DATE_OF_INCORP, 'dd/mm/yyyy') || '";"'||
                TO_CHAR(a.DATE_OF_LIQUIDATION, 'dd/mm/yyyy') || '";"'||
                a.SOURCE_DATE_OF_LIQ || '";"'||
                TO_CHAR(a.REF_DATE_DATE_OF_LIQ, 'dd/mm/yyyy') || '";"'||
                a.NACE_CODE || '";"'||
                a.VERSION_NACE || '";"'||
                a.SOURCE_CODE_NACE || '";"'||
                TO_CHAR(a.REF_DATE_NACE, 'dd/mm/yyyy') || '";"'||
                a.NUMBER_PERS_EMPLOYED || '";"'||
                a.SOURCE_CODE_PERS_EMPL || '";"'||
                a.CONS_PERSON_EMPLOYED || '";"'||
                TO_CHAR(a.REF_DATE_PERS_EMPLOYED, 'dd/mm/yyyy') || '";"'||
                a.SPECIAL_PURP_ENTITY_CODE || '";"'||
                a.SOURCE_CODE_SPE || '";"'||
                TO_CHAR(a.REF_DATE_SPE_CODE, 'dd/mm/yyyy') || '";"'||
                a.EMAIL_ADDRESS || '";"'||
                TO_CHAR(a.REF_DATE_EMAIL_ADDRESS, 'dd/mm/yyyy') || '";"'||
                a.WEB_ADDRESS || '";"'||
                TO_CHAR(a.REF_DATE_WEB_ADDRESS, 'dd/mm/yyyy') || '";"'||
                a.P_EU_LEU_ID || '";"'||
                a.P_NAME_LEGAL_UNIT || '";"'||
                a.P_COUNTRY_CODE_BOP || '";"'||
                a.STATUS_RELATIONSHIP || '";"'||
                a.PERCENTAGE || '";"'||
                a.KIND_OF_CONTROL || '";"'||
                a.SOURCE_CODE_RELATIONSHIP || '";"'||
                TO_CHAR(a.REF_DATE_RELATIONSHIP, 'dd/mm/yyyy') || '";"'||
                a.GLOBAL_LEVEL || '";"'||
                a.GGH_EU_LEU_ID || '";"'||
                a.GGH_NAME_LEGAL_UNIT || '";"'||
                a.GGH_COUNTRY_CODE_BOP || '";"'||
                a.GGH_NSA_ID || '";"'||
                a.GGH_DUNS_NUMBER || '";"'||
                a.GGH_BVD_ID || '";"'||
                a.GGH_SOURCE_IDENTITY || '";"'||
                a.GLOBAL_EG_ID || '";"'||
                a.GLOBAL_EG_NAME || '";"'||
                a.TOP_MNE_IND || '";"'||
                a.GEG_PERSONS_EMPLOYED || '";"'||
                a.GEG_SOURCE_CODE_PERS_EMPL || '";"'||
                TO_CHAR(a.GEG_REF_DATE_PERS_EMPL, 'dd/mm/yyyy') || '";"'||
                a.NUMBER_OF_LEGAL_UNITS || '";"'||
                a.GEG_NACE_CODE_DIV || '";"'||
                a.GEG_SOURCE_CODE_NACE || '";"'||
                TO_CHAR(a.GEG_REF_DATE_NACE, 'dd/mm/yyyy') || '";"'||
                a.GEG_CONS_TURNOVER || '";"'||
                a.GEG_VALUTA_CONS_TURNOVER || '";"'||
                TO_CHAR(a.GEG_BEGIN_CONS_TURNOVER, 'dd/mm/yyyy') || '";"'||
                TO_CHAR(a.GEG_END_CONS_TURNOVER, 'dd/mm/yyyy') || '";"'||
                a.GEG_SOURCE_CONS_TURNOVER || '";"'||
                TO_CHAR(a.GEG_REF_DATE_C_TURNOVER, 'dd/mm/yyyy') || '";"'||
                a.GEG_TOTAL_ASSETS || '";"'||
                a.GEG_VALUTA_TOTAL_ASSETS || '";"'||
                a.GEG_SOURCE_TOTAL_ASSETS || '";"'||
                TO_CHAR(a.GEG_REF_DATE_TOTAL_ASSETS, 'dd/mm/yyyy') || '";"'||
                a.GEG_WEB_ADDRESS || '";"'||
                a.GDC_EU_LEU_ID || '";"'||
                a.GDC_NAME_LEGAL_UNIT || '";"'||
                a.GDC_COUNTRY_CODE_BOP || '";"'||
                a.GDC_NSA_ID || '";"'||
                a.GDC_DUNS_NUMBER || '";"'||
                a.GDC_BVD_ID || '";"'||
                a.GDC_SOURCE_IDENTITY || '";"'||
                a.REP_EU_LEU_ID || '";"'||
                a.REP_NAME_LEGAL_UNIT || '";"'||
                a.REP_POST_DELIVERY_POINT || '";"'||
                a.REP_POSTAL_CODE || '";"'||
                a.REP_STATE_NAME || '";"'||
                a.REP_CITY_NAME || '";"'||
                a.REP_COUNTRY_CODE_BOP || '"'
                );
           UTL_FILE.new_line (f);
      END LOOP;
      UTL_FILE.new_line (f);
      UTL_FILE.fclose(f);
      
        EXCEPTION
          WHEN NO_DATA_FOUND
            THEN dbms_output.put_line ('FAILED');
            
    END EXPORT_FRAME;
    I get an error message:

    Error from the 1 in the command line:
    begin EXPORT_FRAME ('EXP ','test2.csv '); end;
    Error report:
    ORA-29285: error writing file
    ORA-06512: at "SYS." UTL_FILE", line 136
    ORA-06512: at "SYS." UTL_FILE", line 813
    ORA-06512: at the 'EGR. EXPORT_FRAME', line 13
    ORA-06512: at line 1
    29285 00000 - "file write error".
    * Cause: Unable to write in, rinse, or closing a file.
    * Action: Check that the file exists, be accessible and which
    It is open for write or add mode.

    Any idea?

    Thanks in advance!

    Default UTL_FILE. FOPEN opens the file with a record size up to 1024 characters (including line breaks). Most likely your code is greater than 1024. Change:

    f: = utl_file.fopen (dir, filename, 'w');

    something like (assuming that none of your records will exceed 10000)

    f: = utl_file.fopen (dir, filename, 'w', 10000);

    SY.

  • Having a problem to recognize the file using the utl_file package...

    Hello

    I use utl_file utility to read the CSV file, utl_file.fopen function is useed to open the file. The fopen function has three input parameters, the second parameter is the name of the file. My problem is that I need to read file on a daily basis. The file name will be like:-DDMMYYYYHHMISS. Last six characters are for the hour minute second generational file. If the name has only DDMMYYYY then I can give the name of file as TO_CHAR(SYADATE,'DDMMYYYY'), for an individual the same date throughout the day. But the hours, minutes and seconds will be time when the file is generated, it can be different for different days. In this case how can I normalize the value for the filename parameter in the function fopen.

    Thanks in advance.

    Similar to the jeenesh solution:

    declare
     fexists boolean;
     fname varchar2(20) := to_char(trunc(sysdate),'DDMMRRRR');
     ......
    begin
     . ...
       for i in 1..24*3600 loop
         utl_file.fgetattr(location,filename || to_char(to_date(i-1,'sssss'),'HHMISS'),fexists,file_length,block_size);
         if fexists then fname = fname || to_char(to_date(i-1,'sssss'),'HHMISS'); exit; end
      end loop;
    .... --- now you can open the file with above found filename
    
    end;
    /
    
  • Help about the utl_file package

    Hi all
    I'm new on utl_file

    I created a directory

    Create directory LOGDIR AS 'G:\logdir\ '.

    My dbuser with DBA privileges.

    Here is my code
    DECLARE
    vDATA  VARCHAR2(4000);
    vInHandle  utl_file.file_type;
    BEGIN
      vInHandle := utl_file.fopen('LOGDIR', 'TEST.TXT', 'R');
    UTL_FILE.GET_LINE(vInHandle,vDATA,256);
     
    dbms_output.put_line(vDATA);
      
    END ;


    but when i run this code it gives me

    Error on line 0
    DECLARE
    vDATA  VARCHAR2(4000);
    vInHandle  utl_file.file_type;
    vOutHandle ut

    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 475
    ORA-29283: invalid file operation
    ORA-06512: at line 6
    Please help me

    This error indicates usually that there is a problem, see the file. Either the directory on the operating system permissions are incorrect for oracle to be able to see the file or the file does not exist or, if you are using a unix database server then the file names will be case-sensitive. I assume that your oracle server is not unix that you have specified a windows style path in your directory. (You obviously realize that UTL_FILE can only access the database server file system and local client filesystems not?)

  • Hi I need to read the data in vaiables local file delimited using the utl_file package «»


    Hi all

    I want to read data from a .csv file which is ',' delimited in a local variable that is different from a plsql stored procedure so that I can insert into the table.

    I use this way to read data...

    --------------------------------------------------------------------------------

    -get the position of ',' (comma) in csv file

    --------------------------------------------------------------------------------

    l_c1: = INSTR (l_in_file, ',', 1, 1);

    l_c2: = INSTR (l_in_file, ',', 1, 2);

    l_c3: = INSTR (l_in_file, ',', 1, 3);

    l_c4: = INSTR (l_in_file, ',', 1, 4);

    l_c5: = INSTR (l_in_file, ',', 1, 5);

    l_c6: = INSTR (l_in_file, ',', 1, 6);

    l_c7: = INSTR (l_in_file, ',', 1, 7);

    l_c8: = INSTR (l_in_file, ',', 1, 8);

    l_c9: = INSTR (l_in_file, ',', 1, 9);

    l_c10: = INSTR (l_in_file, ',', 1, 10);

    --------------------------------------------------------------------------------
    -pull data into local variables
    --------------------------------------------------------------------------------
    l_0003: = SUBSTR (l_in_file, l_c2 + 1, l_c3-(l_c2 + 1));

    l_0004: = SUBSTR (l_in_file, l_c3 + 1, l_c4-(l_c3 + 1));

    l_0005: = SUBSTR (l_in_file, l_c4 + 1, l_c5-(l_c4 + 1));

    l_0006: = SUBSTR (l_in_file, l_c5 + 1, l_c6-(l_c5 + 1));

    l_0007: = SUBSTR (l_in_file, l_c6 + 1, l_c7-(l_c6 + 1));
    l_0007: = To_Char (To_Date (l_bdate_0007, "mm/dd/yyyy '"), 'yyyy-mm-dd');

    l_0008: = SUBSTR (l_in_file, l_c7 + 1, l_c8-(l_c7 + 1));

    l_0009: = SUBSTR (l_in_file, l_c8 + 1, l_c9-(l_c8 + 1));

    l_0016: = SUBSTR (l_in_file, l_c9 + 1, l_c10-(l_c9 + 1));
    l_0016: = To_Char (To_Date (l_eff_dt_0016, "mm/dd/yyyy '"), 'yyyy-mm-dd');

    I need to find an alternative way to reduce the length of the Code.

    Any Suggestion please!

    Hello

    Please see the query below...

    SELECT RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 1), ',') AS part_1

    , RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 2), ',') AS part_2

    , RTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ' [^,] *,', 1, 3), ',') AS part_3

    , LTRIM (REGEXP_SUBSTR ('John, 100, Manager, 26000', ', [^,] *', 1, 3), ',') AS part_4

    DOUBLE;

  • I bought photoshop element 13 and as I installed it I got a message that it cannot be installed on a computer laptop 64 bit. Nothing was written on the package that it was for a 32-bit machine. What can I do?

    What can I do?

    Try to download the 64-bit version and see if the serial number you have worked with her.

    PES 10, 11, 12, 13 - http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-10-11-downloads.html

    You can also download the demo version of the software through the page linked below and then use your current serial number to activate it.

    Don't forget to follow the steps described in the Note: very important Instructions in the section on the pages of this site download and have cookies turned on in your browser, otherwise the download will not work correctly.

    Photoshop/Premiere Elements 13: http://prodesigntools.com/photoshop-elements-13-direct-download-links-premiere.html

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

  • Invalid directory with UTL_FILE question

    Hi all

    I am facing problem of invalid directory with UTL_FILE package. Someone could review my mwntioned code below and correct me if something wrong here.

    SQL > DECLARE
    2 directory VARCHAR2 (300): = "$XXEQ_TOP/data/ar/invoices";
    3 name VARCHAR2 (300): = 'GEM5289_04102011 - 03.dat';
    4 l_file UTL_FILE.file_type;
    5 l_text VARCHAR2 (32767).
    6 l_text_not_null VARCHAR2 (32767).
    7. START
    8 l_file: =.
    9 UTL_FILE.fopen (directory,
    10 file name,
    11 'r ',.
    12 32767);
    13 UTL_FILE.get_line (l_file, l_text, 32767);
    14 DBMS_OUTPUT. Put_line ('first save' | l_text);
    15 UTL_FILE.fclose (l_file);
    16 EXCEPTION
    17 THEN THAN OTHERS THEN
    18 DBMS_OUTPUT. Put_line ("Exception" |) SQLERRM);
    END 19;
    20.
    ExceptionORA-29280: invalid directory path

    PL/SQL procedure successfully completed.

    Concerning
    Ramanantsoa nara

    UTL_FILE_DIR parameter has been deprecated by oracle for direcory objects because of its security problems.

    The right thing to do is to create a directory for instance object:

    CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';
    

    Note: This does not create the directory on the file system. Must you do and make sure that oracle has permission to write to this directory of the file system.

    Then, grant permission to users who need to access for example...

    GRANT READ,WRITE ON DIRECTORY mydir TO myuser;
    

    Then use this object directory inside your FOPEN statement example

    fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');
    

    Note: You MUST specify the object name of directory in quotes and uppercase for this works because it is a string that references a database object name that is stored in uppercase by default.

  • How to add a character using UTL_FILE pkg

    A table with student_id, student_name and date_of_join.
    create table student(std_id varchar2(10),std_name varchar2(20),std_doj date);
    I'm loading data from flat file below using UTL_FILE package
    101   ron   04081999
    101   ron   01081996
    102   ram   05082000
    102   ram   12101999
    103   fin   06082001
    104   gin   07082002
    105   gem   08082003
    I use a procedure to load the data into the table using the UTL_FILE package

    Student ID 101 & 102 have two dates mating as they registered for two courses. In the flat file, there is no change in the std_id, but I have to add a 'C' character to those who have registered for the second course.

    I have to add a character in column std_id. for example: after loading the result I want is
    std_id          std_name          std_doj
    --------------------------------------------------------------
    101          ron               04081999
    101C          ron               01081996
    102          ram               05082000
    102C          ram               12101999
    103            fin                06082001
    104             gin               07082002
    105             gem               08082003          
    Can you please give me an idea on how to get the result above using UTL_PACKAGE in the procedure?

    It has nothing to do with UTL_FILE. In your charge process you are a loop in the file line by line, right? IF you need to:

    DECLARE
        prev_std_id number;
    BEGIN
        LOOP
          read a line
          parse it into std_id, std_name and std_doj
          IF std_id = prev_std_id
            THEN
              std_id := std_id  || 'C';
            ELSE
              prev_std_id := std_id;
          END IF;
          insert row
        END LOOP;
    END;
    

    SY.

  • Procedure in package - unique all of the benefits of performance?

    We have generally a practice of holding procedures similarly module you which deals with the same features so-called consecutively in the same package.
    We know that what we do for performance benefits,
    because once a procedure inside a package is called, the whole package with all its procedures is responsible for memory, then it improves performance when we also work with other procedures in the package, DISK_READS probably decreases,

    But I have a question here.
    Suppose that I have a single autonomous procedure.
    And I the same, written procedure within a package, just a single procedure, written inside the package.
    Is there any kind of delivery?

    Manuella,

    One of the advantages is that you have more maintainable and reusable code.

    Consider that you are looking for a feature to convert a string to a table. and if it is not available in the oracle supplied packages, you decide to move forward and your own utility function str2table wite.

    Rather than create a standlone function, if you create it as a package... whenever someone in the team comes up with a custom utility requirement, it would be to add it to the package as wel. In this way over a period of time, before anyone writes a function utiity, he would know exactly where to look. It's a pretty good way to keep the code and help people to reuse the code that you have written useful packaging these procedures.

    Thank you
    Rajesh.

  • ORACLE 10g RAC and UTL_FILE

    Hello

    I have a piece of code that works perfectly well on a DB of RAC no but I need to deploy this code on a RAC installation.

    I am trying to create files using UTL_FILE package on a RAC database functions but I get below error: -.

    ORA-29283: invalid file operation
    ORA-06512: at "SYS." UTL_FILE", line 29
    ORA-06512: at "SYS." UTL_FILE", line 473
    ORA-29283: invalid file operation
    ORA-06512: at "OCSG. GENERATE_CDRFILE', line 115
    ORA-06512: at the level of line 12

    Can someone please help?
    29283, 00000, "invalid file operation"
    // *Cause:  An attempt was made to read from a file or directory that does
    //          not exist, or file or directory access was denied by the
    //          operating system.
    // *Action: Verify file and directory access privileges on the file system,
    //          and if reading, verify that the file exists.
    
  • May not grant execute on UTL_FILE even user with the DBA role

    Hi all

    I have a problem - I can not grant execute on UTL_FILE to < some_user >, even if I am logged in as a user with the DBA role.
    grant execute on UTL_FILE to seesat_stg;
    ORA-00942: table or view does not exist

    Is the synonym PUBLIC:
    select owner, object_name, object_type from all_objects where object_name = 'UTL_FILE'
    Returns:
    SYS          UTL_FILE     PACKAGE
    SYS          UTL_FILE     PACKAGE BODY
    PUBLIC          UTL_FILE     SYNONYM
    FLOWS_030100     UTL_FILE     SYNONYM
    Any ideas what I am doing wrong? It's about Oracle XE.

    It works if you open a session as SYS?

    I suspect that your user with the DBA role not really has the right to grant permissions execute on UTL_FILE.

Maybe you are looking for

  • Make a zoom + setting line

    Is it possible to get lines of text adjusted after a zoom before (Firefox for Mobile)?I can't do it now, then text lines exceed the width of the screen and it is very difficult to read.

  • Warranty for Alu 2 500 GB StorE

    Hello Never needing support for my Toshiba products before I'm lost trying to find how can I RMA my drive of 500 GB Toshiba Store Alu 2, who died on me.Also, I don't have the drive and the cable on the left, I put the box in a cell he came in origina

  • I'm looking for STE in operating system.

    Hello How can I get the ETS? can I have a free version or a trial? Kind regards!

  • set update not installed not message when I try to update

    set update not installed not message when I try to update (security update for Windows XP Edition Media Center Edition 2005 Update Rollup 2 X 86 (KB2619340)

  • Response time of the provider for BlackBerry World Portal

    Is it just me or response time to requests for change appear to have increased? I usually get 1 to 2 days for an update of the app and 1 day for app list changes. During the last two weeks, I've waited a week for an update of the app. Even more, I've