PU Chapter 06 Oracle Supplied Packages Scripts
PU Chapter 06 Oracle Supplied Packages Scripts
Example (PU_06_01)
CONN system/sys
CREATE OR REPLACE DIRECTORY my_dir AS 'c:\my_files';
GRANT READ, WRITE ON DIRECTORY my_dir TO HR;
EXECUTE pu_06_04;
-------------------------------------------------------------------------------------
Example (PU_06_05)
v_olddeptno := v_newdeptno;
END LOOP;
EXCEPTION
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
RAISE_APPLICATION_ERROR (-20001, 'Invalid File.');
WHEN UTL_FILE.WRITE_ERROR THEN
RAISE_APPLICATION_ERROR (-20002, 'Unable to write to file');
END sal_status;
--RUN UTLMAIL.SQL
-------------------------------------------------------------------------------------
Example (PU_06_08)
CREATE OR REPLACE PROCEDURE send_mail_file
IS
BEGIN
UTL_MAIL.SEND_ATTACH_VARCHAR2 (
sender => '[email protected]',
recipients => '[email protected]',
MESSAGE => '<HTML><BODY> See attachment</BODY></HTML>',
subject => 'oracle Notes',
mime_type => 'text/html',
attachment => 'note_txt',
att_inline => false,
att_mime_type=> 'text/plain',
att_filename => 'notes.txt');
END send_mail_file;
-------------------------------------------------------------------------------------