(9I R2) UTL_FILE.FREMOVE를 이용하여 OS FILE을 지우는 방법

제품 : PL/SQL
작성날짜 : 2003-01-20
(9I R2) UTL_FILE.FREMOVE를 이용하여 OS FILE을 지우는 방법
=========================================================
PURPOSE
UTL_FILE package을 사용하여 OS file을 지우는 sample을 만들어 본다.
UTL_FILE.FREMOVE는 Oracle 9i Release 2 이상에서 가능하며 이전 버젼에서는
제공되지 않는다.
Explanation
Oracle 9i Release 2 에서 UTL_FILE package에 다음과 같은 새로운 procedure가
추가되었다.
UTL_FILE.FCOPY(), UTL_FILE.FRENAME(), UTL_FILE.FREMOVE() , UTL_FILE.FGETATTR()
1) FCOPY ( Unix에서의 cp와 유사 ) procedure
: 모든 또는 일부분의 file을 copy한다.
2) FRENAME (Unix에서의 mv와 유사) procedure
: 존재하고 있는 file을 새로운 이름으로 바꾸며, 또한 이미 같은 file 이름이 존재한다면
overwrite할건지의 option이 존재한다.
3) FREMOVE (Unix에서의 rm와 유사) procedure
: 적당한 DIRECTORY OBJECT privilege 와 operating system
privilege가 있다면, DISK에 존재하는 file을 지운다.
4) FGETATTR procedure
:file의 특성을 읽고 그 값을 return한다.
UTL_FILE.FCOPY (location, filename, dest_dir,
dest_file, start_line, end_line);
UTL_FILE.FRENAME (location, filename, dest_dir, dest_file, overwrite);
UTL_FILE.FREMOVE (location, filename);
UTL_FILE.FGETATTR (location, filename, exists,
file_length, blocksize, create_date, mod_date);
Example
예제 1)
SQL> conn / as sysdba
Connected.
SQL> CREATE OR REPLACE DIRECTORY NEW_DIR as '/home/ora920/tool/jooyeon';
Directory created.
SQL> GRANT READ ON DIRECTORY NEW_DIR to scott;
Grant succeeded.
SQL> !ls new.txt
new.txt
SQL> BEGIN
UTL_FILE.fremove ('NEW_DIR','new.txt');
EXCEPTION
WHEN UTL_FILE.delete_failed THEN
dbms_output.put_line('Error while deleting the file');
END;
/ 2 3 4 5 6 7
PL/SQL procedure successfully completed.
예제 2)
SQL> connect sys/manager as sysdba
Connected.
SQL> create or replace directory public_access as '/home/ora920/tool';
Directory created.
SQL> grant read on directory public_access to public;
Grant succeeded.
SQL> conn scott/tiger
Connected.
SQL> create table tcopy01_out (line varchar2(500), i number);
Table created.
SQL>
create procedure tcopy01_p as
errbuf varchar2(50);
dir varchar2(512) := 'PUBLIC_ACCESS';
f1 utl_file.file_type;
type t_files is table of utl_file.file_type
index by binary_integer;
files t_files;
i number := 0;
ok boolean := TRUE;
pos number;
len number;
blk number;
procedure insertoutput (line varchar2) is
begin
insert into tcopy01_out values (line, i);
i := i+1;
end insertoutput;
begin
f1 := utl_file.fopen('PUBLIC_ACCESS', 'tcopy01.dat', 'w');
utl_file.put_line(f1, 'Copy tcopy01.dat to tcopy01c.dat, line 1.');
utl_file.put_line(f1, 'Copy tcopy01.dat to tcopy01c.dat, line 2.');
utl_file.put_line(f1, 'Copy tcopy01.dat to tcopy01c.dat, line 3.');
utl_file.put_line(f1, 'Copy tcopy01.dat to tcopy01c.dat, line 4.');
utl_file.put_line(f1, 'Copy tcopy01.dat to tcopy01c.dat, line 5.');
utl_file.put_line(f1, 'Copy tcopy01.dat to tcopy01c.dat, line 6.');
utl_file.fclose(f1);
-- Full copy
begin
utl_file.fcopy('PUBLIC_ACCESS', 'tcopy01.dat','PUBLIC_ACCESS','tcopy01c.dat');
f1 := utl_file.fopen('PUBLIC_ACCESS', 'tcopy01c.dat', 'r');
utl_file.fclose(f1);
insertoutput('SUCCESS: Copied 1 file');
exception
when others then
errbuf := substr(sqlerrm, 1, 50);
insertoutput ('Unexpected exception raised: '||errbuf);
end;
-- Partial copy
begin
utl_file.fcopy('PUBLIC_ACCESS', 'tcopy01.dat','PUBLIC_ACCESS',
'tcopy01c2.dat',2,4);
utl_file.fgetattr('PUBLIC_ACCESS','tcopy01c2.dat',ok,len,blk);
insertoutput('SUCCESS: Copied file size='||len);
exception
when others then
errbuf := substr(sqlerrm, 1, 50);
insertoutput ('Unexpected exception raised: '||errbuf);
end;
begin
utl_file.fcopy('PUBLIC_ACCESS', 'tcopy01.dat','PUBLIC_ACCESS',
'tcopy01.dat');
utl_file.fgetattr('PUBLIC_ACCESS','tcopy01.dat',ok,len,blk);
insertoutput('SUCCESS: Copied file size='||len);
exception
when others then
errbuf := substr(sqlerrm, 1, 50);
insertoutput ('Unexpected exception raised: '||errbuf);
end;
-- Rename
f1 := utl_file.fopen('PUBLIC_ACCESS', 'trename01.dat', 'w');
utl_file.put_line(f1, 'File b, line 1.');
utl_file.fclose(f1);
f1 := utl_file.fopen('PUBLIC_ACCESS', 'trename012.dat', 'w');
utl_file.put_line(f1, 'File b, line 1.');
utl_file.fclose(f1);
-- Successful case
begin
utl_file.frename('PUBLIC_ACCESS','trename01.dat','PUBLIC_ACCESS','trename01c.dat');
f1 := utl_file.fopen('PUBLIC_ACCESS', 'trename01c.dat', 'r');
utl_file.fclose(f1);
f1 := utl_file.fopen('PUBLIC_ACCESS', 'trename01.dat', 'r');
exception
when utl_file.invalid_path then
insertoutput('SUCCESS: file renamed ');
when utl_file.rename_failed then
insertoutput('FAILURE: rename failed ');
end;
-- Successful case with overwrite flag
begin
utl_file.frename('PUBLIC_ACCESS','trename012.dat','PUBLIC_ACCESS','trename01c.dat',TRUE);
f1 := utl_file.fopen('PUBLIC_ACCESS', 'trename01c.dat', 'r');
utl_file.fclose(f1);
f1 := utl_file.fopen('PUBLIC_ACCESS', 'trename01.dat', 'r');
exception
when utl_file.invalid_path then
insertoutput('SUCCESS: file renamed ');
when utl_file.rename_failed then
insertoutput('FAILURE: rename failed ');
end;
commit;
exception
when others then
errbuf := substr(sqlerrm, 1, 50);
insertoutput ('Unexpected exception raised: '||errbuf);
commit;
end;
show errors
SQL> exec tcopy01_p;
ora920:/home/ora920/tool> ls -al
GU0h 40
drwxr-xr-x 5 ora920 dba 4096 1?y 20 10:19 ./
drwxr-x--- 31 ora920 dba 8192 1?y 20 13:05 ../
-rw-r--r-- 1 ora920 dba 0 1?y 20 10:19 tcopy01.dat
-rw-r--r-- 1 ora920 dba 252 1?y 20 10:19 tcopy01c.dat
-rw-r--r-- 1 ora920 dba 126 1?y 20 10:19 tcopy01c2.dat
-rw-r--r-- 1 ora920 dba 16 1?y 20 10:19 trename012.dat
-rw-r--r-- 1 ora920 dba 16 1?y 20 10:19 trename01c.dat
ora920:/home/ora920/tool> cat *.dat
Copy tcopy01.dat to tcopy01c.dat, line 1.
Copy tcopy01.dat to tcopy01c.dat, line 2.
Copy tcopy01.dat to tcopy01c.dat, line 3.
Copy tcopy01.dat to tcopy01c.dat, line 4.
Copy tcopy01.dat to tcopy01c.dat, line 5.
Copy tcopy01.dat to tcopy01c.dat, line 6.
Copy tcopy01.dat to tcopy01c.dat, line 2.
Copy tcopy01.dat to tcopy01c.dat, line 3.
Copy tcopy01.dat to tcopy01c.dat, line 4.
File b, line 1.
File b, line 1.
References
<Note:216450.1>
<Note:196948.1>
Korean Bulletin : 18488
PURPOSE
Explanation
Example
Reference Documents
-------------------

Similar Messages

  • Unable to remove *.log files using utl_file.fremove

    Hi,
    I want to remove .log files using the below command
    I want to remvoe all the *.log files but its remvoing only one .log file
    utl_file.fremove(location => dir_name, filename => log_file_name);
    Any help will be needful for me

    In the documentation for your unknown version of oracle you can view the definition of utl_file.fremove.
    Everywhere it states utl_file.fremove removes a file, not 1 or more, and the documentation doesn't discuss the use of wildcards.
    It seems like the question could have been prevented by reading docs (which almost no one here does), and you need to use Java to address your requirement.
    Personally I wouldn't misuse Oracle to perform O/S tasks.
    Sybrand Bakker
    Senior Oracle DBA

  • Utl_file.fremove doesn't work unless UTL_FILE_DIR is set (10gR1 on Windows)

    Hello,
    can someone confirm that the procedure utl_file.fremove does not work and raises ORA-29280 when you try to remove a file from a directory on the server and there is no corresponding UTL_FILE_DIR set?
    I created an oracle directory object for the file directory and issued the necessary grant read,write to the user executing the procedure, but fremove returns an error until I put the directory path in UTL_FILE_DIR in the SPFILE.
    This seems to conflict with what is stated in the documentation of the package where the user is even encouraged to avoid UTL_FILE_DIR altogether.
    What am I missing here?
    Bye,
    Flavio

    Flavioc,
    i used one of the already available directories for the test and it seems to work.
    and also there is no value set for UTL_FILE_DIR in my database.
    SQL> BEGIN
      2    UTL_FILE.FREMOVE('LOG_FILE_DIR','UTL_FILE.XLS');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> column name format a30
    SQL> column value format a30
    SQL> select name, value from v$parameter where name like 'utl_file_dir'
      2  /
    NAME                           VALUE
    utl_file_dir
    SQL> select directory_path
      2  from all_directories
      3  where directory_name like 'LOG_FILE_DIR'
      4  /
    DIRECTORY_PATH
    c:\oracle\product\10.1.0\Db_1\demo\schema\log\But same thing failed when i created a directory object on a path which was outside oracle home.

  • Help with utl_file (read/write file from local directory)

    Need help reading/writing file on local machine from plsql using 10.2 DB.
    I am trying to read/write a file from a local directory(laptop) without success.
    I have been able to read/write to the database server directory but can't write to directory on local machine.
    The utl_file_dir parm has been set to * and the db restarted but I can't get it to work... Here's the plsql statement.
    out_file := UTL_FILE.FOPEN ( 'C:\PLSQL', 'TEST.TXT', 'W' ,32767);
    Whenever I run it continues to write to c:\PLSQL dir on the database server. Have looked at the "Directory" object and created MY_DIR = C:\PLSQL but it writes to the db server.
    Running 10.2 on a remote windows server, running PLSQL using sql*navigator.
    Thanks in advance for your help..

    I don't see how you expect the server to be able to see your laptop across the network, hack into it and start writing files. Even if it could, what if there is more than one laptop with a C: drive? How would it know which one to write to?
    Is there a shared drive on the server you can access via the laptop?

  • Does UTL_FIL utility supports file writing in to remote Host ??

    Hi,
    I am checking the possibility with UTL_FIL utility whether supports file writing in to remote Host. My database is on different server from UNIX server but i want to make use of Oracle directory objects or UTL_FILES functions to be able to write files directly from Oracle to remote UNIX server.
    Is this possible ?
    Thanks
    Anand

    UTL_FILE, and any other PL/SQL package running on the database server, can only access objects that the database server has access to. Unless the remote Unix server's file system is mounted from the Oracle server's file system, UTL_FILE would be unable to create a file there.
    Now, there may well be alternateives. For example, you could generate the file locally and FTP the file to the remote Unix server, assuming the remote Unix server is running a FTP server.
    Justin

  • Utl_file not generating file but no raising no exceptions

    The utl_file_dir is set to /tmp/usr on my system. I am trying to write a simple file in this directory as follows :
    declare
    l_filehandle UTL_FILE.FILE_TYPE;
    begin
    l_filehandle := UTL_FILE.FOPEN('/usr/tmp', 'test_file','w');
    utl_file.putf(l_filehandle, 'test');
    utl_file.fclose(l_filehandle);
    end;
    When i run this, i do not see any errors but at the same time the file is not generated. Any ideas what the issue may be.
    I ran this from both sqlplus client and from the unix server but no luck in both teh cases. The procedure just completes without generating the file.
    please help
    thanks
    Satya

    thanks for the response, apparantly it was creating the files on a different server. I'm not sure why or how.
    But thanks, problem solved !!

  • Utl_fil - checking for file not found

    Hi,
    I am reading in a txt file whose name is specified in a parameter.
    How do I trap the not found condition using utl_file in opening the txt file.
    Thanx.....

    Maybe like this:
    SQL> DECLARE
       f             UTL_FILE.file_type;
       fexists       BOOLEAN;
       file_length   NUMBER;
       block_size    BINARY_INTEGER;
    BEGIN
       UTL_FILE.fgetattr ('TEMP', 'file1.txt', fexists, file_length, block_size);
       IF fexists
       THEN
          DBMS_OUTPUT.put_line ('File exists');
       ELSE
          DBMS_OUTPUT.put_line ('File does not exist');
       END IF;
    END;
    File does not exist

  • Writing CLOB data using UTL_FILE to several files by settingmaxrows in loop

    Hey Gurus,
    I have a procedure that creates a CLOB document (in the form of a table in oracle 9i). I need to now write this large CLOB data (with some 270,000 rows) into several files, setting the row max at 1000. So essentially ther would be some sort of loop construct and substr process that creates a file after looping through 1000 rows and then continues the count and creates a another file until all 270 xml files are created. Simple enough right...lol? Well I've tried doing this and haven't gotten anywhere. My pl/sql coding skills are too elementary I am guessing. I've only been doing this for about three months and could use the assistance of a more experienced person here.
    Here are the particulars...
    CLOB doc is a table in my Oracle 9i application named "XML_CLOB"
    Directory name to write output to "DIR_PATH"
    DIRECTORY PATH is "\app\cdg\cov"
    Regards,
    Chris

    the xmldata itself in the CLOB would look like this for one row.
    <macess_exp_import_export_file><file_header><file_information></file_information></file_header><items><documents><document><external_reference></external_reference><processing_instructions><update>Date of Service</update></processing_instructions><filing_instructions><folder_ids><folder id="UNKNOWN" folder_type_id="19"></folder></folder_ids></filing_instructions><document_header><document_type id="27"></document_type><document_id>CUE0000179</document_id><document_description>CUE0000179</document_description><document_date name="Date of Service">1900-01-01</document_date><document_properties></document_properties></document_header><document_data><internal_file><document_file_path>\\adam\GiftSystems\Huron\TIFS\066\CUE0000179.tif</document_file_path><document_extension>TIF</document_extension></internal_file></document_data></document></documents></items></macess_exp_import_export_file>

  • UTL_FILE to open files 32K

    Hi,
    I am new to this, so please help.
    I have a procedure which makes the call: fileHandler := UTL_FILE.FOPEN(p_utl_dir, p_file_name, 'W');
    However the output gets clipped after 32K (Which i see from the docs - is the upper limit). How can I make it handle higher value than 32k?
    Thanks in advance.

    as
        fileHandler UTL_FILE.FILE_TYPE;
        v_last_rtype number(5) := 0;
      --  type cur_type is ref cursor;
       -- i cur_type;
        i_category_id number(3);
        i_seq_no number(2);
        i_seq_desc varchar2(20);
        i_name varchar2(30);
        i_work_phone varchar2(30);
        i_email_address varchar2(100);
        i_pager varchar2(30);
        i_cell varchar2(30);
        i_home_phone varchar2(30);
        i_category_name varchar2(15);
        i_picture varchar2(400);
        background_color varchar2(30);
        it_only_email varchar2(4000);
        last_category varchar2(15);
        cursor contact_stmt is
        select name,
               work_phone,
               pager,
               cell,
               home_phone
        from   contacts
        order by category_id,
                 job_title,
                 name;
        cursor select_stmt is
        select seq.category_id,
           seq_no,
           decode(seq_no,1,'Primary',2,'Secondary','Other') seq_desc,
           b.name,
           work_phone,
           email_address,
           pager,
           cell,
           home_phone,
          'http://abc.com/~mbansal/pictures/'||gif_name  picture,
           decode(seq_no,1,substr(c.name,1,15),' ') category_name
    from ( select category_id,
                  dense_rank() over (partition by category_id
                                     order by category_id,
                                              last_date desc,
                                              from_date desc,
                                              decode( sign(seq_no - mod(week_diff,max_seq)), -- push up logic
                                                 0, max_seq ,
                                                 -1,max_seq - mod(week_diff,max_seq)+seq_no,
                                                    seq_no- mod(week_diff,max_seq)) asc) seq_no,
                                              /* push down logic -- decode( sign(max_seq - (seq_no+
                                               mod(week_diff,max_seq))),-1, abs(max_seq -
                                               (seq_no+ mod(week_diff,max_seq))),
                                                seq_no+ mod(week_diff,max_seq)) asc) seq_no,*/
                  contact_id,
                  last_date,
                  from_date,
                  week_diff,
                  rank,
                  max_seq
           from  (select category_id,
                         seq_no,
                         a.contact_id,
                         nvl(to_date, sysdate - 365) last_date,
                         from_date,
                         floor((trunc(sysdate+(7*week_no)) - trunc(from_date))/7) week_diff,
                         dense_rank () over( partition by category_id,
                                                          a.contact_id
                                             order by nvl(to_date, sysdate - 365) desc,
                                                      from_date desc,
                                                      seq_no desc) rank,
                         max(seq_no) over (partition by category_id) max_seq
                  from   oncall_sequence a,
                         (select 0 week_no from dual)
                  where  sysdate + (6/24) + (7*week_no)
                           between from_date and nvl(to_date,sysdate + (7*week_no) + 1)
                  order by 1,
                           4 desc ,
                           5 desc ,
                           2 desc)
           where rank = 1) seq,
           contacts b,
           category c
    where  seq.contact_id = b.contact_id
    and    seq.category_id = c.category_id
    order  by 1,2;
        p_utl_dir varchar2(100) := '/oracle/archives/orcl';
        p_file_name varchar2(100) := 'itoncall.html';
      begin
          fileHandler := UTL_FILE.FOPEN(p_utl_dir, p_file_name, 'W',32767);
          UTL_FILE.PUTF(fileHandler,
    '<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
      <title>IT on call page</title>
      This on call information is for  production environment only, It is not for general IT issues.
    <body style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"
    link="#33ccff" vlink="#33ccff" alink="#33ccff">
    <span style="color: rgb(255, 255, 255);">
    </span>
    <div style="text-align: center; color: rgb(255, 255, 255);">
    <center>
    <table border="3" cellspacing="0" cellpadding="0"
    style="width: 600px; background-color: rgb(255, 255, 204); height: 59px;">
      <tbody style="background-color: rgb(255, 255, 204);">
        <tr style="background-color: rgb(255, 255, 204);">
          <td style="background-color: rgb(255, 255, 204);"><big> </big>
          <center style="background-color: rgb(255, 255, 204);"><big><big><font
    face="Arial Black" size="+1"><big><big>IT ON CALL</big></big></font><font
    face="Arial Black" size="+1"><big><big>!</big></big></font></big></big></center>
          </td>
        </tr>
      </tbody>
    </table>
    </center>
    </div>
    <br>
    <center></center>
    <center>
    <table border="0" cellspacing="0" cellpadding="10" cols="1"
    style="width: 600px; background-color: rgb(255, 255, 255);">
      <tbody>');
          for i in select_stmt
          loop
           i_category_id := i.category_id;
           i_seq_no := i.seq_no;
           i_seq_desc := i.seq_desc;
           i_name := i.name;
           i_work_phone := i.work_phone;
           i_email_address := i.email_address;
           i_pager := i.pager;
           i_cell := i.cell;
           i_home_phone := i.home_phone;
           i_picture := i.picture;
           i_category_name := i.category_name;
            insert into oncall_history(from_date,
                                       seq_no,
                                       category_id,
                                       name)
            values(sysdate,
                   i_seq_no,
                   i_category_id,
                   i_name);
            if   i_seq_no in (1,2)
            then if  i_seq_no = 1
                 then background_color := 'rgb(204, 255, 255)';
                 else background_color := 'rgb(204, 204, 255)';
                 end if;
                 UTL_FILE.PUTF(fileHandler,
    '<tr>
          <td
    style="vertical-align: top; text-align: left; background-color: '||background_color||'; width: 30%;"
    rowspan="2" colspan="1"><big
    style="background-color: '||background_color||';"><font size="+2"><big><span
    style="font-weight: bold; color: rgb(255, 0, 0); font-family: courier new,courier,monospace;">'||i_category_name||'</span></big></font></big><br>
          <img
    src="'||i_picture||'"
    title="" alt="" style="width: 116px; height: 100px;">
          <br>
          </td>
          <td
    style="vertical-align: top; background-color: '||background_color||';"> <small><font
    size="+2"><small><span
    style="font-weight: bold; color: rgb(0, 0, 153); font-family: courier new,courier,monospace;">'||i_seq_desc||'</span></small></font></small>
          </td>
        </tr>
        <tr>
          <td style="background-color: '||background_color||';"><big><font
    size="-1"><big><font face="Verdana"><span style="font-weight: bold;"><span
    style="color: rgb(255, 0, 0);"><small>Name:</small> </span><big
    style="color: rgb(0, 0, 153);">'||i_name||'</big><br>
          <small><span style="color: rgb(255, 0, 0);">Work#:</span></small>
          <big style="color: rgb(0, 0, 153);">'||i_work_phone||'</big><br>
          <small><span style="color: rgb(255, 0, 0);">Cell#:</span></small>
          <big style="color: rgb(0, 0, 153);">'||i_cell||'</big><br>
          <small><span style="color: rgb(255, 0, 0);">Home#:</span></small>
          <big style="color: rgb(0, 0, 153);">'||i_home_phone||'</big><br>
          <small><span style="color: rgb(255, 0, 0);">Email:</span></small>
          </span></font><small style="color: rgb(0, 0, 153);"><font
    face="Verdana"><span style="font-weight: bold;">'||i_email_address||'</span></font></small></big></font></big><font
    face="Verdana"><font size="+1"><span style="font-weight: bold;"><small><big><big><font
    size="-1"><big><br>
          <small><span style="color: rgb(255, 0, 0);">Pager:</span></small>
          <big style="color: rgb(0, 0, 153);">'||i_pager||'</big> </big></font></big></big><small><small></small></small></small><br>
          </span></font></font></td>
        </tr>');
            end if;
          end loop;
          commit;
          UTL_FILE.PUTF(fileHandler, ' </tbody>
                                          </table>
                                          </center>
    <center></center>
    <center>
    <table border="0" cellspacing="0" cellpadding="0" cols="1" width="600">
      <tbody>
        <tr>
         <br>
          <td><font face="Arial,Helvetica"><font color="#33ccff"><font size="+0"><big style="font-weight: bold; color: rgb(255, 0, 0);">
      Escalations into IT: (policy to be followed by BLOC, support, etc) </big> <br> <br>
          <font face="Arial,Helvetica"><font color="#33ccff"><font size="-2">
              <big style="color: rgb(102, 51, 51);">
               * If an issue requires escalation to IT, submit trouble ticket e-mail to [email protected] and for tracking submit IT Helpdesk ticket. Be as detailed as possible about the issue and include priority and impact of the issue.  <br>
               * Immediately call primary on-call cell phone. If no answer, leave message and immediately call home phone, leave message if no answer. <br>
               * 15 minutes after contacting primary, if no response: Call secondary on-call cell phone. If no answer, leave message and immediately call home phone, leave message if no answer.  <br>
               * 30 minutes after contacting primary, if no response from primary or secondary: Call IT Manager cell phone. If no answer, leave message and immediately call home phone, leave message if no answer.  <br>
               * 60 minutes after contacting primary, if no response from primary or secondary or IT manager: Call Operations Manager cell phone. If no answer, leave message and immediately call home phone, leave message if no answer. </big> <br> <br>
    </font></font></font></td>
        </tr>
      <table border=0 cellspacing=0 cellpadding=0 style="border-collapse:collapse;
       mso-padding-alt:0in 5.4pt 0in 5.4pt">
       <tr>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><b><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">Name<o:p></o:p></span></b></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><b><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">Home Phone<o:p></o:p></span></b></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><b><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">Cell Phone<o:p></o:p></span></b></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><b><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">Pager#<o:p></o:p></span></b></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><b><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">Work Phone<o:p></o:p></span></b></p>
        </td>
       </tr>
       <tr>
        <td width=119 valign=top style="width:89.55pt;padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><![if !supportEmptyParas]><![endif]><o:p></o:p></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><![if !supportEmptyParas]><![endif]><o:p></o:p></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><![if !supportEmptyParas]><![endif]><o:p></o:p></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><![if !supportEmptyParas]><![endif]><o:p></o:p></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><![if !supportEmptyParas]><![endif]><o:p></o:p></p>
        </td>
       </tr>
          for i in contact_stmt
          loop
            i_name := i.name;
            i_work_phone := i.work_phone;
            i_pager := i.pager;
            i_cell := i.cell;
            i_home_phone := i.home_phone;
            UTL_FILE.PUTF(fileHandler, '
       <tr>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">'||i_name||'<o:p></o:p></span></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">'||i_home_phone||'<o:p></o:p></span></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">'||i_cell||'<o:p></o:p></span></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">'||i_pager||'<o:p></o:p></span></p>
        </td>
        <td width=119 valign=top style="width:89.55pt;background:#CCFFFF;
        padding:0in 5.4pt 0in 5.4pt">
        <p class=MsoNormal><span style="font-size:9.0pt;mso-bidi-font-size:12.0pt">'||i_work_phone||'<o:p></o:p></span></p>
        </td>
          </tr>
          end loop;
          UTL_FILE.PUTF(fileHandler, '
        <tr> <br>
          <td><font face="Arial,Helvetica"><font color="#33ccff"><font
    size="-2">Updated on '||to_char(sysdate,'Month DD, YYYY')||'.</font></font></font></td>
        </tr>
      </tbody>
    </table>
    </center>
                                          </body>
                                          </html>');
          UTL_FILE.FCLOSE(fileHandler);
    -- This will email everyone about their status
          for i in select_stmt
          loop
           i_category_id := i.category_id;
           i_seq_no := i.seq_no;
           i_seq_desc := i.seq_desc;
           i_name := i.name;
           i_work_phone := i.work_phone;
           i_email_address := i.email_address;
           i_pager := i.pager;
           i_cell := i.cell;
           i_home_phone := i.home_phone;
           i_picture := i.picture;
           i_category_name := i.category_name;
            if   i_seq_no in (1,2)
            then if  last_category is null
                  or (last_category != i_category_name
                  and ltrim(i_category_name) is not null)
                 then last_category := i_category_name;
                 end if;
                 if   i_email_address is not null
                 then oramon.send_alert(i_email_address,
                                        'You are '||i_seq_desc||' On-call '||last_category,
                                        'Please note that this week you are '||i_seq_desc||' '||last_category);
                 end if;
                 it_only_email := it_only_email||rpad(i_category_name,15)||': '||i_seq_desc||' is '||i_name||chr(10);
            end if;
          end loop;
          oramon.send_alert('[email protected]',
                            'This week''s On-Call admins',
                             it_only_email);
    end ;

  • Newbie Upoad PDF to blob then Delete File.pdf

    I want the user to upload A PDF and import it into A BLOB.
    That part is working.
    If the user uploads the WRONG PDF, I want them to be able to delete the FILEA.PDF.
    They can delete the FILEA.PDF, if they wait 4 or 5 minutes.
    Delete the FileA.PDF is the part that is not working, if the user does it in less
    than 4 or 5 minutes.
    The PDF is about 60K.
    Below is the sample code:
    =========================
    <code>
    SELECT mypdf
    INTO temp_blob
    FROM fcsImpactUpload
    where renname= 'FileB.PDF'
    FOR update;
    IF dbms_lob.fileexists(src_file)=1 THEN
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    lgh_file := dbms_lob.getlength(src_file);
    dbms_lob.loadfromfile(temp_blob, src_file, lgh_file);
    UPDATE fcsImpactUpload
    SET de_pdf = temp_blob
    where renname= 'FileB.PDF';
    COMMIT;
    END IF;
    UTL_FILE.FGETATTR('AIMSORAPDF', 'FileA.PDF', DOESEXIST, FLEN, BSIZE);
    IF DOESEXIST THEN
    UTL_FILE.FREMOVE('AIMSORAPDF','FileA.PDF');
    ELSE
    EXIT; -- File does not exist
    END IF;
    </code>

    Forget to say verasion
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    "CORE     10.2.0.4.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

  • File Location in UTL_FILE

    Hi,
    I'm using UTL_FILE and I've asked my DBA to configure a location on the network as UTL_FILE's default file location, say, "c:\utl" on oraserver. Now, how do I pass this to UTL_FILE.FOPEN ? Do I say :
    X := UTL_FILE.FOPEN( 'C:\UTL', 'TEST', 'w' );
    or like this :
    X := UTL_FILE.FOPEN( '\\oraserver\UTL', 'TEST', 'w' );
    Any help would be really appreciated.
    Regards,
    Alex

    Alex,
    the correct form is:
    X := UTL_FILE.FOPEN( 'C:\UTL', 'TEST', 'w' );
    Greetings,

  • CSV file reading using UTL_FILE at run time

    Hi,
    I have to read CSV file using UTL_FILE.
    but Folder contains Many CSV files.
    I dont know there name.So i have to read csv file at run time.
    Please let me know how should we achieve this?
    Thanks

    place the following in a shell script, say "list_my_files.ksh"
    ls -l > my_file_list.datthen run the shell script using dbms_scheduler;
    begin
    dbms_scheduler.create_program (program_name   => 'a_test_proc'
                                  ,program_type   => 'EXECUTABLE'
                                  ,program_action => '/home/bluefrog/list_my_files.ksh'
                                  ,number_of_arguments => 0
                                  ,enabled => true);
    end;
    /then open "my_file_list.dat" using UTL_FILE, read all file names and choose the one you require.
    P;

  • Cant delete file from a folder..

    Hello All,
    I am using Oracle Database 10g on Linux OS
    I want to delete some file using PL-SQL for that I have written following program.
    DECLARE
    fileHandler UTL_FILE.FILE_TYPE;
    BEGIN
    UTL_FILE.FREMOVE ('MY_DIRECTORY','my_filet.txt');
    EXCEPTION
    when others then
    dbms_output.put_line('error is = '||sqlerrm);
    END;
    but when I execute this I get a error message as
    error is = ORA-29283: invalid file operation
    but the Directory Name and File name are valid, though the error is there .Why?
    Pls help
    thanks in advance
    Regards,
    Abhijit.

    It probably has to do with the permissions and file ownership of the target file on the server.
    I tried the same code. I was able to delete a file where the owner was 'oracle' , and got the same error you have mentioned while trying to delete a file of another user with wrong permissions.
    -Ashwin
    Message was edited by:
    ashwinkr

  • Delete file in the filesystem

    Hello,
    I am developing an application with the apex.
    I created a section where you can upload files to the linux file system to a specific folder, not upload to the database, I do not want me to take unnecessary space.
    I can also download the file list and I'm interested.
    Now what interests me to complete my application is that when I list the files that are uploaded, I can delete one that interests me this and to delete the file system,
    I tried to remove it UTL_FILE.FREMOVE but I think it only works with files with extension. txt, and I have files with different extension type pdf, doc ... etc.
    Can you give me a solution?
    My OS is ubuntu 10.10 and used Application Express 4.0.2.00.07
    Thanks
    Greetings

    The exceptions raised by <tt>utl_file.fremove</tt> are listed in the procedure's documentation. <tt>no_data_found</tt> is not one of the docuimented exceptions: if the exception is being raised by <tt>utl_file.fremove</tt>, then either it <em>might</em> be an undocumented feature&mdash;and hence a documentation bug&mdash;or an Oracle software bug. However the problem is more likely to be in your code.
    It's very difficult to troubleshoot this problem remotely: it can't be replicated on apex.oracle.com due to the file system access required, and no one but you has access to your server. You'll therefore need to provide a very complete picture of the situation.
    <li>What is your full database version and edition (get this using <tt>select banner from v$version</tt>)
    <li>Where is your code? If it's all in your APEX app, then upload the app to apex.oracle.com and either make an export link available or post developer login credentials here. (We can't replicate the problem there but it's the easiest way to see the full code.) If the code is in a package or procedure then post it here <em>wrapping the code \...\ tags</em> to preserve formatting.
    <li>Replicate the circumstances of the error and post the results here. If possible do this using a reduced test case from sqlplus as this will be easier to cut/paste. If you have to do it through APEX then get a debug trace. Again wrap any diagnostic output/trace in \...\ tags.
    <li>Post a full directory listing (<tt>ls -al</tt>) of the relevant OS directory at the time of the error here, wrapped in \...\ tags.

  • How can I move or delete files with PL-SQL???

    I have Oracle 9i and Sun Solaris 5.8
    I have a table (“TABLE_FILENAME”) with the files name in one directory. (I read the files name in a directory and put it in a table). I charge some files with external tables and then I have to move some fields to another directory and delete others files.
    How can I delete files with PL-SQL and How can I move files with PL-SQL?
    I have the names of files and the actions (Delete o Move) in a table (“TABLE_FILENAME”) (The files in this table are dynamics).

    If you're using 9i then you will find that the new functions UTL_FILE.FCOPY and UTL_FILE.FREMOVE will allow you to do what you want. Check out the documentation for more details.
    Cheers, APC

Maybe you are looking for

  • ITunes mixing up song names and the album artworks.

    This is hard to explain but I'll do my best. For the record, I have 2 iPods that sync with the same playlist (iPod Touch 2nd Gen 4.2.1 for main music and iPod Nano 5th Gen for excercise). I decided to rip a recently purchased CD today and sync it to

  • Fan Control and Leopard

    While I am happy with Leopard, it killed my Fan Control - now I face a roasting each time I use my MBP. Anyone know if this little gem will be updated for 10.5? Fan speeds of 1500rpm just don't cut it with a Core Duo.

  • Move order pick slip report in Oracle Application 11i

    hello I have problem with Move Order Pick Slip Report in Oracle Application 11i that in my system it is not running. when I submit this report from my system, the application halt and I have to restart application on my system. on other computer it i

  • Firefox keeps "Not Responding" randomly, then comes back after 10-15 Seconds.

    Every now and then, when I'm on Firefox it will not respond then the window will fill white and at the top it will say "Mozilla Firefox (Not Responding)". It responds after about 10-15 seconds but this keeps happening every 2-3 Minutes and is making

  • ODBC Error in connect string?

    I am running 8i 8.1.6 oracle, forms 6i, and am trying to connect to a AS400 DB2 database. I have the ODBC driver for the AS400 setup properly. When I try to connect in Forms 6i or SQL*Plus with the connect string odbc:datasource_name (ie. odbc:AS400)